Last active
April 21, 2016 15:20
-
-
Save t0mmyt/8ec0ba86f16488bb6b50ce60c151de90 to your computer and use it in GitHub Desktop.
AWS CLI
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
| # Requires describe tags in IAM | |
| aws ec2 --region eu-west-1 describe-tags --filter "Name=resource-id,Values=$(curl -ss http://169.254.169.254/latest/meta-data/instance-id)" | jq '.Tags[] | select(.Key=="aws:autoscaling:groupName").Value' | |
| # Get IPs of other instances in my ASG | |
| aws ec2 --region eu-west-1 describe-instances --filter Name=tag:aws:autoscaling:groupName,Values=$(aws ec2 --region eu-west-1 describe-tags --filter "Name=resource-id,Values=$(curl -ss http://169.254.169.254/latest/meta-data/instance-id)" | jq '.Tags[] | select(.Key=="aws:autoscaling:groupName").Value') | jq '.Reservations[].Instances[] | select(.State.Name=="running") | .NetworkInterfaces[0].PrivateIpAddress' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment