Last active
May 1, 2020 20:16
-
-
Save ayosec/1991ab9a674c1ad86438fa359cf20d38 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
export AWS_DEFAULT_REGION=${REGION:-eu-west-1} | |
aws ec2 describe-addresses \ | |
--query 'Addresses[*][InstanceId, PublicIp]' \ | |
--output text \ | |
| while read ID IP | |
do | |
echo -en "$IP\\t" | |
aws ec2 describe-instances \ | |
--instance-ids $ID \ | |
--query "Reservations[].Instances[].Tags[?Key=='Name'].Value" \ | |
--output text | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment