Skip to content

Instantly share code, notes, and snippets.

Created April 14, 2015 15:46
Show Gist options
  • Save anonymous/5f62cd1d7e313cdac225 to your computer and use it in GitHub Desktop.
Save anonymous/5f62cd1d7e313cdac225 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