Created
December 22, 2014 08:25
-
-
Save maimai-swap/58e058798dce3cd28831 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
#!/bin/sh | |
# lb-hogehoge = ELB Tag Name Value | |
for instance_id in `aws elb describe-load-balancers --query 'LoadBalancerDescriptions[?LoadBalancerName==\`lb-hogehoge\`].["Instances"[]["InstanceId"]]' --output text` | |
do | |
ips=`aws ec2 describe-instances --instance-id $instance_id --query Reservations[].["Instances"[]["NetworkInterfaces"][][]["PrivateIpAddresses"][][]["PrivateIpAddress"]] --output text` | |
for ip in $ips | |
do | |
echo $ip | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lb-hogehogeの名前をかえて動かしてください。