Skip to content

Instantly share code, notes, and snippets.

@kondanta
Created August 8, 2019 14:34
Show Gist options
  • Save kondanta/ea1a926bb93c4322011e68cb7218c5d1 to your computer and use it in GitHub Desktop.
Save kondanta/ea1a926bb93c4322011e68cb7218c5d1 to your computer and use it in GitHub Desktop.
Finding instances on aws with "Name" tag.
#!/bin/sh
aws --region "$1" ec2 describe-instances --query 'Reservations[].Instances[?Tags[?Key == `Name` && contains(Value, `'"$2"'`)][]][].{ip:PublicIpAddress, type:InstanceType, name:[Tags[?Key==`Name`].Value][0][0]}' | jq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment