Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.

Commit a0ccdc5

Browse files
authored
optimized CFN template
removed mappings and added SSM Parameter as this will dynamically allow for the latest ecs-optimized-ami each time. - /aws/service/ecs/optimized-ami/amazon-linux-2/gpu/recommended/image_id - /aws/service/ecs/optimized-ami/amazon-linux-2/arm64/recommended/image_id - /aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id - /aws/service/ecs/optimized-ami/amazon-linux/recommended/image_id Note: Your user account must have the following IAM permissions to retrieve the Amazon ECS-optimized AMI metadata. These permissions have been added to the AmazonECS_FullAccess IAM policy. ssm:GetParameters ssm:GetParameter ssm:GetParametersByPath
1 parent 20dd18e commit a0ccdc5

File tree

1 file changed

+10
-36
lines changed

1 file changed

+10
-36
lines changed

templates/ecs-cluster.yaml

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,45 +27,19 @@ Parameters:
2727
VpcId:
2828
Type: AWS::EC2::VPC::Id
2929

30+
ECSOptimizedImage:
31+
Description: ECS-Optimized AMI ID
32+
Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
33+
Default: /aws/service/ecs/optimized-ami/amazon-linux/recommended/image_id
34+
AllowedValues:
35+
- /aws/service/ecs/optimized-ami/amazon-linux-2/gpu/recommended/image_id
36+
- /aws/service/ecs/optimized-ami/amazon-linux-2/arm64/recommended/image_id
37+
- /aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id
38+
- /aws/service/ecs/optimized-ami/amazon-linux/recommended/image_id
3039

3140
Conditions:
3241
EC2: !Equals [ !Ref LaunchType, "EC2" ]
3342

34-
35-
Mappings:
36-
AWSRegionToAMI:
37-
ap-south-1:
38-
AMI: ami-00491f6f
39-
eu-west-3:
40-
AMI: ami-9aef59e7
41-
eu-west-2:
42-
AMI: ami-67cbd003
43-
eu-west-1:
44-
AMI: ami-1d46df64
45-
ap-northeast-2:
46-
AMI: ami-c212b2ac
47-
ap-northeast-1:
48-
AMI: ami-872c4ae1
49-
sa-east-1:
50-
AMI: ami-af521fc3
51-
ca-central-1:
52-
AMI: ami-435bde27
53-
ap-southeast-1:
54-
AMI: ami-910d72ed
55-
ap-southeast-2:
56-
AMI: ami-58bb443a
57-
eu-central-1:
58-
AMI: ami-509a053f
59-
us-east-1:
60-
AMI: ami-28456852
61-
us-east-2:
62-
AMI: ami-ce1c36ab
63-
us-west-1:
64-
AMI: ami-74262414
65-
us-west-2:
66-
AMI: ami-decc7fa6
67-
68-
6943
Resources:
7044
ECSRole:
7145
Type: AWS::IAM::Role
@@ -160,7 +134,7 @@ Resources:
160134
- /etc/cfn/cfn-hup.conf
161135
- /etc/cfn/hooks.d/cfn-auto-reloader.conf
162136
Properties:
163-
ImageId: !FindInMap [ AWSRegionToAMI, !Ref "AWS::Region", AMI ]
137+
ImageId: !Ref ECSOptimizedImage
164138
InstanceType: !Ref InstanceType
165139
IamInstanceProfile: !Ref InstanceProfile
166140
SecurityGroups:

0 commit comments

Comments
 (0)