Skip to content

Instantly share code, notes, and snippets.

@ssstonebraker
Created January 17, 2018 20:53
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 ssstonebraker/793aac06472912a94f7325d6b51a7ef3 to your computer and use it in GitHub Desktop.
Save ssstonebraker/793aac06472912a94f7325d6b51a7ef3 to your computer and use it in GitHub Desktop.
Get all ami's in use on and aws account
#!/bin/bash
# get_amis.sh
# Return a list of all ami's in use in aws
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[ImageId,Tags[*]]' | grep ami | perl -pi -e "s/,//g;" | perl -pi -e "s/\"//g;" | perl -pi -e "s/\s+/\n/g;" | grep -v "^$"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment