Skip to content

Instantly share code, notes, and snippets.

@kilfu0701
Created February 12, 2019 01:13
Show Gist options
  • Save kilfu0701/4037671d6f9cfcd6007cf20af4c8fb9e to your computer and use it in GitHub Desktop.
Save kilfu0701/4037671d6f9cfcd6007cf20af4c8fb9e to your computer and use it in GitHub Desktop.
get private IP address by aws instance id
aws ec2 describe-instances --output json --region ap-northeast-1 --instance-ids i-YYYYYY | \
python -c "
import sys;
import json;
print(json.loads(sys.stdin.read())['Reservations'][0]['Instances'][0]['PrivateIpAddress'])
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment