Skip to content

Instantly share code, notes, and snippets.

Created April 14, 2015 15:50
Show Gist options
  • Save anonymous/06252e19a5ccd2ab98cf to your computer and use it in GitHub Desktop.
Save anonymous/06252e19a5ccd2ab98cf to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'aws-sdk'
ec2 = Aws::EC2::Client.new(
region: 'eu-central-1'
)
resource = Aws::EC2::Resource.new(client: ec2)
allInstances = Array.new
resource.instances(filters: [{'instance-state-name',['stopped']}]).each do |instance|
puts instance.instance_id
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment