Skip to content

Instantly share code, notes, and snippets.

@bil9000
Last active February 11, 2021 21:02
Show Gist options
  • Save bil9000/2cf0d6bd88eb32faaa6feca815b0db2b to your computer and use it in GitHub Desktop.
Save bil9000/2cf0d6bd88eb32faaa6feca815b0db2b to your computer and use it in GitHub Desktop.
finding aws ec2 stuff. This command grabs the InstanceID, Instance Name, PrivateIP and VPC
aws ec2 describe-instances \
--filters Name=tag-key,Values=Name \
--query 'Reservations[*].Instances[*].{Instance:InstanceId,Vpc:VpcId,PrivateIP:PrivateIpAddress,Name:Tags[?Key==`Name`]|[0].Value}' --output table >> instances.tsv
@bil9000
Copy link
Author

bil9000 commented Feb 11, 2021

This command grabs the InstanceID, Instance Name, PrivateIPAddresss and VPC - it is best to have your aws configure run first or it will bomb. Then it dumps it out in to a tab-separated-value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment