Last active
December 17, 2015 09:39
-
-
Save popowa/5589018 to your computer and use it in GitHub Desktop.
EC2で作った自分のイメージ(AMI)一覧をRuby SDKで出す方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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