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

Optimized EC2 build with SSM Parameter #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions bin/get_amis.sh

This file was deleted.

46 changes: 10 additions & 36 deletions templates/ecs-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,19 @@ Parameters:
VpcId:
Type: AWS::EC2::VPC::Id

ECSOptimizedImage:
Description: ECS-Optimized AMI ID
Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: /aws/service/ecs/optimized-ami/amazon-linux/recommended/image_id
AllowedValues:
- /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

Conditions:
EC2: !Equals [ !Ref LaunchType, "EC2" ]


Mappings:
AWSRegionToAMI:
ap-south-1:
AMI: ami-00491f6f
eu-west-3:
AMI: ami-9aef59e7
eu-west-2:
AMI: ami-67cbd003
eu-west-1:
AMI: ami-1d46df64
ap-northeast-2:
AMI: ami-c212b2ac
ap-northeast-1:
AMI: ami-872c4ae1
sa-east-1:
AMI: ami-af521fc3
ca-central-1:
AMI: ami-435bde27
ap-southeast-1:
AMI: ami-910d72ed
ap-southeast-2:
AMI: ami-58bb443a
eu-central-1:
AMI: ami-509a053f
us-east-1:
AMI: ami-28456852
us-east-2:
AMI: ami-ce1c36ab
us-west-1:
AMI: ami-74262414
us-west-2:
AMI: ami-decc7fa6


Resources:
ECSRole:
Type: AWS::IAM::Role
Expand Down Expand Up @@ -160,7 +134,7 @@ Resources:
- /etc/cfn/cfn-hup.conf
- /etc/cfn/hooks.d/cfn-auto-reloader.conf
Properties:
ImageId: !FindInMap [ AWSRegionToAMI, !Ref "AWS::Region", AMI ]
ImageId: !Ref ECSOptimizedImage
InstanceType: !Ref InstanceType
IamInstanceProfile: !Ref InstanceProfile
SecurityGroups:
Expand Down