Skip to content

Instantly share code, notes, and snippets.

@tjpatter
Created March 28, 2016 14:59
Show Gist options
  • Save tjpatter/9e3ffd602e0c4f80bacd to your computer and use it in GitHub Desktop.
Save tjpatter/9e3ffd602e0c4f80bacd to your computer and use it in GitHub Desktop.
#!/bin/bash
ip=$1
aws ec2 describe-instances --filter "Name=private-ip-address, Values=${ip}" --query 'Reservations[*].Instances[*].{InstanceId:InstanceId,PrivateIpAddress:PrivateIpAddress,Name:Tags[?Key==`Name`] | [0].Value}' --output text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment