Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- instance_id['rows'].each do |row|
- instances = row['normal']['tags']
- instances.each do |instance|
- volume_id_json = `aws ec2 describe-instances --instance-ids #{instance} --output json`
- volume_ids = JSON.parse(volume_id_json)
- volume_ids['Reservations'][0]['Instances'][0]['BlockDeviceMappings'].map do |volume_id|
- volumes = volume_id['Ebs']['VolumeId']
- volumes.each do |volume|
- description="Snapshot of Instance #{instance} created on #{DATE}"
- `aws ec2 create-snapshot --volume-id "#{volume}" --description "#{description}"`
- exitstatus = $?.to_i
- if exitstatus != 0
- puts "Unable to get node names from Chef"
- end
- end
- end
- end
- end
- ebs_snapshot_new.rb:21:in `block (3 levels) in <main>': undefined method `each' for "vol-2662ec23":String (NoMethodError)
- from ebs_snapshot_new.rb:19:in `map'
- from ebs_snapshot_new.rb:19:in `block (2 levels) in <main>'
- from ebs_snapshot_new.rb:16:in `each'
- from ebs_snapshot_new.rb:16:in `block in <main>'
- from ebs_snapshot_new.rb:14:in `each'
- from ebs_snapshot_new.rb:14:in `<main>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement