Created
August 2, 2018 15:52
-
-
Save dsmrt/6936d2c4aaa1e54a3d62a041856d5a77 to your computer and use it in GitHub Desktop.
Get the latest recommended ECS optimized AMIs printed for CloudFormation Mappings
This file contains hidden or 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
| #!/bin/bash | |
| echo "AWSRegionToAMI:" | |
| for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text) | |
| do | |
| echo " ${region}:"; | |
| AMI=$(aws ssm get-parameters --names /aws/service/ecs/optimized-ami/amazon-linux/recommended --region $region | jq -r '.Parameters[0].Value | fromjson | .image_id') | |
| printf " AMI: %s \n" $AMI | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No longer need to do this. You can now use the ssm parameter as a CloudFormation parameter.