Skip to content

Instantly share code, notes, and snippets.

@popowa
Last active December 17, 2015 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popowa/5589018 to your computer and use it in GitHub Desktop.
Save popowa/5589018 to your computer and use it in GitHub Desktop.
EC2で作った自分のイメージ(AMI)一覧をRuby SDKで出す方法
require 'rubygems'
require 'yaml'
require 'aws-sdk'
AWS.config({
:access_key_id => 'XXXXXXXXXXXXXXXXX',
:secret_access_key => 'XXXXXXXXXXXXXXXXX',
:ec2_endpoint => 'ec2.ap-northeast-1.amazonaws.com'
})
ec2 = AWS::EC2.new
my_images = ec2.images.with_owner('self')
my_images.each { |image|
puts "#{image.id}, #{image.name}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment