-
-
Save prafulmehrotra/6d2f8ca4d9edfe2fd7a6be3d36277451 to your computer and use it in GitHub Desktop.
Build CloudFormation mappings for the latest ECS Optimized AMI for every Region for your account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "AWSRegionToAMI:" | |
for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text) | |
do | |
echo " ${region}:" | |
echo -n " AMI: " | |
aws ec2 describe-images \ | |
--owners amazon \ | |
--query 'reverse(sort_by(Images[?Name != `null`] | [?contains(Name, `amazon-ecs-optimized`) == `true`], &CreationDate))[:1].ImageId' \ | |
--output text \ | |
--region $region | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment