Created
November 18, 2014 10:22
-
-
Save mkamakura/d749cf994786e6f2e5fd to your computer and use it in GitHub Desktop.
ELB配下のプライベートIPアドレスを取得する
This file contains hidden or 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
AWS.config({ | |
:access_key_id => '<アクセスキー>', | |
:secret_access_key => '<シークレットキー>', | |
:ec2_endpoint => 'ec2.ap-northeast-1.amazonaws.com', | |
:elb_endpoint =>'elasticloadbalancing.ap-northeast-1.amazonaws.com' | |
}) | |
elb = AWS::ELB.new.load_balancers['<ELB名>'] | |
instances = elb.instances.select {|i| i.exists? && i.status == :running}.map(&:private_ip_address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment