Skip to content

Instantly share code, notes, and snippets.

@russellds
Created July 30, 2018 19:59
Show Gist options
  • Save russellds/1e52df6e67d6bf6a61c62d72b60ba905 to your computer and use it in GitHub Desktop.
Save russellds/1e52df6e67d6bf6a61c62d72b60ba905 to your computer and use it in GitHub Desktop.
AWS Instance Details
#!/bin/bash
echo 'InstanceId,KeyPair,PrivateIpAddress,PublicIpAddress,InstanceType,Tags,OwnerId' > $HOME/aws-instance-details.csv
aws ec2 describe-instances --filters --query 'Reservations[].Instances[].[InstanceId,KeyName,PrivateIpAddress,PublicIpAddress,InstanceType,Tags[?Key==`Name`].Value[]]' --output text |
sed 's/\t/,/g' >> $HOME/aws-instance-details.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment