Method: AWS::EC2::SnapshotCollection#create

Defined in:
lib/aws/ec2/snapshot_collection.rb

#create(opts = {}) ⇒ Snapshot

Creates a snapshot of an Amazon EBS volume and stores it in Amazon S3. You can use snapshots for backups, to make identical copies of instance devices, and to save data before shutting down an instance. For more information about Amazon EBS, go to the Amazon Elastic Compute Cloud User Guide.

Parameters:

  • opts (Hash) (defaults to: {})

    Options for creating the snapshot. Either :volume or :volume_id is required.

  • opts (Volume) (defaults to: {})

    :volume The Amazon EBS volume of which to take a snapshot.

  • opts (String) (defaults to: {})

    :volume_id The ID of the Amazon EBS volume of which to take a snapshot.

  • opts (String) (defaults to: {})

    :description An optional description of the snapshot. May contain up to 255 characters.

Returns:

  • (Snapshot)

    An object representing the new snapshot.



105
106
107
108
109
110
111
# File 'lib/aws/ec2/snapshot_collection.rb', line 105

def create opts = {}
  if volume = opts.delete(:volume)
    opts[:volume_id] = volume.id
  end
  resp = client.create_snapshot(opts)
  Snapshot.new(resp.snapshot_id, :config => config)
end