Skip to content

Instantly share code, notes, and snippets.

@PauloMigAlmeida
Created October 17, 2017 08:56
Show Gist options
  • Save PauloMigAlmeida/b3b250445798788314bf469f55bdb75b to your computer and use it in GitHub Desktop.
Save PauloMigAlmeida/b3b250445798788314bf469f55bdb75b to your computer and use it in GitHub Desktop.
List latest Amazon Linux AMIs in every AWS region
for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output json | jq -r '.[]'); do
echo "$region = $(aws ec2 describe-images --owners amazon --filters 'Name=name,Values=amzn-ami-hvm-????.??.?.x86_64-gp2' --query 'sort_by(Images, &CreationDate) | [-1].ImageId' --region $region)"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment