Skip to content

Instantly share code, notes, and snippets.

@posilva
Last active February 13, 2020 09:15
Show Gist options
  • Save posilva/441be9c3564a03b2c10eddcfa228eddb to your computer and use it in GitHub Desktop.
Save posilva/441be9c3564a03b2c10eddcfa228eddb to your computer and use it in GitHub Desktop.
AMI Fetch
AMI_FILTER=amzn-ami-hvm-2018.03*-x86_64-ebs
for REGION in us-east-1 us-west-2 us-west-1 eu-west-1 eu-central-1 ap-northeast-1 ap-southeast-1 ap-southeast-2 us-east-2
do
aws --region $REGION ec2 describe-images --owners amazon \
--filters "Name=name,Values=$AMI_FILTER" \
--query 'sort_by(Images, &CreationDate)[] ' | jq -c 'max_by(.CreationDate) | {region: "'$REGION'", name: .Name, image: .ImageId, date: .CreationDate} '
done
@posilva
Copy link
Author

posilva commented Feb 13, 2020

Added region us-east-2

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