Class: AWS::EC2::SnapshotCollection
- Inherits:
-
Collection
- Object
- Collection
- AWS::EC2::SnapshotCollection
- Defined in:
- lib/aws/ec2/snapshot_collection.rb
Overview
Represents a collection of Amazon EBS snapshots. Typically you should get an instance of this class by calling #snapshots.
Instance Method Summary collapse
-
#create(opts = {}) ⇒ Snapshot
Creates a snapshot of an Amazon EBS volume and stores it in Amazon S3.
- #each {|Instance| ... } ⇒ nil
Instance Method Details
#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.
73 74 75 76 77 78 79 |
# File 'lib/aws/ec2/snapshot_collection.rb', line 73 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 |
#each {|Instance| ... } ⇒ nil
44 45 46 47 48 49 50 51 |
# File 'lib/aws/ec2/snapshot_collection.rb', line 44 def each(&block) resp = filtered_request(:describe_snapshots) resp.snapshot_set.each do |v| snapshot = Snapshot.new(v.snapshot_id, :config => config) yield(snapshot) end nil end |