Created
July 25, 2018 07:08
-
-
Save sumit-sampang-rai/49786a37d3f370b5dbbb2dd1753cf669 to your computer and use it in GitHub Desktop.
Get the values of tag:Name of AWS running instances and append with suffix
This file contains 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
PROFILE=srekcahrai;for name in $(aws --profile=$PROFILE --region=us-east-1 ec2 describe-instances --filter Name='instance-state-name',Values='running' --query 'Reservations[*].Instances[*][Tags[?Key==`Name`].Value]' --output text|sort); do echo $name | awk '{print tolower($0) ".srekcahrai.com"}'; done |
This file contains 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
PROFILE=srekcahrai;for name in $(aws --profile=$PROFILE --region=us-east-1 ec2 describe-instances --filter Name='instance-state-name',Values='running' --query 'Reservations[*].Instances[?Tags[?Key==`Deployment` && Value==`Production`]][Tags[?Key==`Name`].Value]' --output text|sort); do echo $name | awk '{print tolower($0) ".srekcahrai.com"}'; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment