Skip to content

Instantly share code, notes, and snippets.

@thedoc31
Created February 3, 2017 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thedoc31/9d8400421d9f7834b4e3e8336dbc2c3c to your computer and use it in GitHub Desktop.
Save thedoc31/9d8400421d9f7834b4e3e8336dbc2c3c to your computer and use it in GitHub Desktop.
Output BIND-friendly list of AWS servernames and EIP addresses based on name wildcard
## be sure your AWS default profile is set up, otherwise use --profile <profilename> to point it to the right account
aws ec2 describe-instances --filters "Name=tag:Name,Values=<wildcard-name-query-here>" --query "Reservations[*].Instances[*].[Tags[?Key=='Name'].Value[],PublicIpAddress]" | tr -d ' ["\r\n' | sed 's/\]\]\,/\r\n/g' | sed 's/\]\,/ 300 A /g' | tr -d ']' | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment