Skip to content

Instantly share code, notes, and snippets.

@srkiNZ84
Created June 11, 2021 02:04
Show Gist options
  • Save srkiNZ84/c737de02fc1f3a4a0e2f265f117e0648 to your computer and use it in GitHub Desktop.
Save srkiNZ84/c737de02fc1f3a4a0e2f265f117e0648 to your computer and use it in GitHub Desktop.
Get AWS EC2 instances using AWS CLI query param
#!/bin/bash
aws --profile dev \
ec2 describe-instances \
--query 'Reservations[].Instances[].[InstanceId,Tags[?Key==`Name`].Value[],NetworkInterfaces[].Association.{IP:PublicIp}]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment