Skip to content

Instantly share code, notes, and snippets.

@popowa
Created May 16, 2013 03:27
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/5589167 to your computer and use it in GitHub Desktop.
Save popowa/5589167 to your computer and use it in GitHub Desktop.
インスタンス一覧とTagからNameな物を出力するだけ
require 'rubygems'
require 'yaml'
require 'aws-sdk'
AWS.config({
:access_key_id => 'XXXXXXXXXXXXXXXXXXXXXXX',
:secret_access_key => 'XXXXXXXXXXXXXXXXXXXXXXX',
:ec2_endpoint => 'ec2.ap-northeast-1.amazonaws.com'
})
ec2 = AWS::EC2.new
ec2.instances.each { |instance|
puts "#{instance.id}, #{instance.image_id}, #{instance.status}, #{instance.tags["Name"]}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment