Guest User

Untitled

a guest
Jun 20th, 2014
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. require 'aws-sdk-core'
  4.  
  5. # Credentials
  6. Aws.config = {
  7. :access_key_id => '',
  8. :secret_access_key => '',
  9. :region => 'eu-west-1'
  10. }
  11.  
  12. ec2 = Aws::EC2.new(region:'eu-west-1')
  13.  
  14. snapshots_resp = ec2.describe_snapshots(owner_ids:[''], filters:[{name:'snapshot-id', values:['snap-58*']}])
  15. snapshots = snapshots_resp.snapshots
  16.  
  17. snapshots.each do |snapshot|
  18. #snapshot_name = (snapshot.tags.select{|tag| tag['key'] == 'Name'}.count > 0) ? snapshot.tags.select{|tag| tag['key'] == 'Name'}[0].value : ''
  19. #puts "ID: #{snapshot.snapshot_id} | Name: #{snapshot_name} | Date: #{snapshot.start_time}"
  20. end
Advertisement
Add Comment
Please, Sign In to add comment