Created
April 6, 2016 12:43
-
-
Save sandromello/9c6ef558b3da49557d515495df117b4f to your computer and use it in GitHub Desktop.
aws-cli get instances ips
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/bash | |
searchString=$1 | |
IpSearchType=PublicIpAddress | |
if [ "$1" = "private" ]; then | |
IpSearchType=PrivateIpAddress | |
searchString=$2 | |
else | |
IpSearchType=PublicIpAddress | |
fi | |
aws ec2 describe-instances --query "Reservations[].Instances[].[$IpSearchType, Tags[?Key==\`Name\`].Value[], Placement]" --filters Name=tag:Name,Values=$searchString |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment