Skip to content

Instantly share code, notes, and snippets.

@arukoh
Created March 31, 2014 04:54
Show Gist options
  • Save arukoh/9885527 to your computer and use it in GitHub Desktop.
Save arukoh/9885527 to your computer and use it in GitHub Desktop.
ELBに紐付くインスタンスの状態一覧を表示するスクリプト。
require "aws-sdk"
['us-east-1', 'ap-northeast-1'].each do |region|
AWS::ELB.new(region: region).load_balancers.each do |elb|
elb.client.describe_instance_health(load_balancer_name: elb.name)[:instance_states].each do |h|
puts "#{region}\t#{elb.name}\t#{h[:instance_id]}\t#{h[:state]}\t#{h[:description]}\t#{h[:reason_code]}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment