Last active
August 18, 2016 23:59
-
-
Save florin-andrei-curbside/7a573ac0e417d304947ee2fce939c4a6 to your computer and use it in GitHub Desktop.
get all public or private IPs from all EC2 instances in default region
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
#!/usr/bin/env bash | |
aws ec2 describe-instances --query 'Reservations[].Instances[].PublicIpAddress' --output=table | \ | |
awk '{print $2}' | grep -v Describe | grep -v -e '^$' | |
aws ec2 describe-instances --query 'Reservations[].Instances[].PrivateIpAddress' --output=table | \ | |
awk '{print $2}' | grep -v Describe | grep -v -e '^$' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment