Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Deleting EBS Snapshots with aws-sdk
require 'rubygems'
require 'active_support/time'
require 'aws-sdk'
threshold = 2.months.ago
ec2 = AWS::EC2.new
ec2.shapshots.with_owner(:self).
select {|s| s.volume_id == 'vol-12345678' && s.start_time < threshold}.
each {|s| puts "Bye-bye #{s.description}"; s.delete}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.