class AWS::EC2::SnapshotCollection

# => { “snap-12345678” => :pending, “snap-87654321” => :completed }
ec2.snapshots.inject({}) { |m, s| m = s.status; m }
@example Get a map of snapshot IDs to snapshot status
snapshot.exists?
snapshot = ec2.snapshots[“vol-123”]
@example Get a snapshot by ID<br><br>ec2.volumes.create_snapshot(“my snapshot”)
# or:
:description => “my snapshot”)
ec2.snapshots.create(:volume => ec2.volumes,
@example Create a snapshot from a volume
{EC2#snapshots}.
you should get an instance of this class by calling
Represents a collection of Amazon EBS snapshots. Typically

def create opts = {}

Returns:
  • (Snapshot) -
  • (Snapshot) - An object representing the new snapshot.

Options Hash: (**opts)
  • :description (String) -- An optional description of
  • :volume_id (String) -- The ID of the Amazon EBS
  • :volume (Volume) -- The Amazon EBS volume of which

Parameters:
  • opts (Hash) -- Options for creating the snapshot.
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

def each(&block)

Returns:
  • (nil) -

Other tags:
    Yield: - Yields each snapshot in the collection.
def each(&block)
  opts = {}
  opts[:owner_ids] = @owners.map { |id| id.to_s } unless @owners.empty?
  opts[:restorable_by_user_ids] = @restorable_by.map { |id| id.to_s } unless
    @restorable_by.empty?
  resp = filtered_request(:describe_snapshots, opts)
  resp.snapshot_set.each do |v|
    snapshot = Snapshot.new(v.snapshot_id, :config => config)
    yield(snapshot)
  end
  nil
end

def initialize(options = {})

Other tags:
    Private: -
def initialize(options = {})
  @owners = options[:owners] || []
  @restorable_by = options[:restorable_by] || []
  super(options)
end

def member_class

def member_class
  Snapshot
end

def preserved_options

def preserved_options
  super.merge(:owners => @owners, :restorable_by => @restorable_by)
end

def restorable_by(*users)

Parameters:
  • users (Array of Strings) -- The AWS account IDs by which

Returns:
  • (ImageCollection) - A new collection that only includes
def restorable_by(*users)
  collection_with(:restorable_by => @restorable_by + users)
end

def with_owner(*owners)

Parameters:
  • owners (Array of Strings) -- The AWS account IDs by

Returns:
  • (SnapshotCollection) - A new collection that only
def with_owner(*owners)
  collection_with(:owners => @owners + owners)
end