Skip to content

Instantly share code, notes, and snippets.

@pm-hwks
Last active August 26, 2019 06:41
Show Gist options
  • Save pm-hwks/6dc9db33f5779700bfe8ae401e845c88 to your computer and use it in GitHub Desktop.
Save pm-hwks/6dc9db33f5779700bfe8ae401e845c88 to your computer and use it in GitHub Desktop.
[awscli - list of AWS instances] Using awscli & jq, get a list of running aws instances #aws #cli #awscli #jq #ec2
# Note : (pre-reqs) : Install & configure AWSCLI, install jq
aws ec2 describe-instances | tee /tmp/ins |
jq --raw-output '.Reservations[].Instances[0] | [ .InstanceId, .PublicIpAddress , .PrivateIpAddress, .PrivateDnsName,
(.Tags[] | select(.Key == "Name") | .Value ) ] | @tsv '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment