Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'aws-sdk-core'
- # Credentials
- Aws.config = {
- :access_key_id => '',
- :secret_access_key => '',
- :region => 'eu-west-1'
- }
- ec2 = Aws::EC2.new(region:'eu-west-1')
- snapshots_resp = ec2.describe_snapshots(owner_ids:[''], filters:[{name:'snapshot-id', values:['snap-58*']}])
- snapshots = snapshots_resp.snapshots
- snapshots.each do |snapshot|
- #snapshot_name = (snapshot.tags.select{|tag| tag['key'] == 'Name'}.count > 0) ? snapshot.tags.select{|tag| tag['key'] == 'Name'}[0].value : ''
- #puts "ID: #{snapshot.snapshot_id} | Name: #{snapshot_name} | Date: #{snapshot.start_time}"
- end
Advertisement
Add Comment
Please, Sign In to add comment