From 7d7f6cc9d947c57e4b3d26f0099491ee8fe08c19 Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Mon, 19 Aug 2019 20:04:00 -0700 Subject: Programmatically retrieve ECS AMI Update cf.yaml to programmatically retrieve Amazon ECS-Optimized AMI -https://docs.aws.amazon.com/AmazonECS/latest/developerguide/retrieve-ecs-optimized_AMI.html --- cf.yml | 46 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) (limited to 'cf.yml') diff --git a/cf.yml b/cf.yml index 82d72e9..bf66dc8 100644 --- a/cf.yml +++ b/cf.yml @@ -2,6 +2,11 @@ AWSTemplateFormatVersion: "2010-09-09" Description: Factorio Spot Price Server via Docker / ECS Parameters: + ECSAMI: + Description: AWS ECS AMI ID + Type: AWS::SSM::Parameter::Value + Default: /aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id + FactorioImageTag: Type: String Description: "(Examples include latest, stable, 0.17, 0.17.33) Refer to tag descriptions available here: https://hub.docker.com/r/factoriotools/factorio/)" @@ -103,45 +108,6 @@ Conditions: Mappings: - Region: - 'us-east-2': - ImageId: ami-0dca97e7cde7be3d5 - 'us-east-1': - ImageId: ami-0fac5486e4cff37f4 - 'us-west-1': - ImageId: ami-0c6e63b58aac1048e - 'us-west-2': - ImageId: ami-0e5e051fd0b505db6 - 'ap-east-1': - ImageId: ami-02252d984c7e3595d - 'ap-northeast-1': - ImageId: ami-04a735b489d2a0320 - 'ap-northeast-2': - ImageId: ami-0accbb5aa909be7bf - 'ap-south-1': - ImageId: ami-0a8bf4e187339e2c1 - 'ap-southeast-1': - ImageId: ami-05c6d22d98f97471c - 'ap-southeast-2': - ImageId: ami-039bb4c3a7946ce19 - 'ca-central-1': - ImageId: ami-01c07ee95e77abba8 - 'eu-central-1': - ImageId: ami-0650e7d86452db33b - 'eu-north-1': - ImageId: ami-059aa04f0c253ad6b - 'eu-west-1': - ImageId: ami-0ae254c8a2d3346a7 - 'eu-west-2': - ImageId: ami-0de1dc478496a9e9b - 'eu-west-3': - ImageId: ami-0d260f3e5ccd06043 - 'sa-east-1': - ImageId: ami-038707d64e5b8e7ba - 'us-gov-east-1': - ImageId: ami-0a224902b35f8ad6c - 'us-gov-west-1': - ImageId: ami-04c68165 ServerState: Running: AutoScalingCapacity: 1 @@ -287,7 +253,7 @@ Resources: Properties: AssociatePublicIpAddress: true IamInstanceProfile: !Ref InstanceProfile - ImageId: !FindInMap [ Region, !Ref 'AWS::Region', ImageId ] + ImageId: !Ref ECSAMI InstanceType: !Ref InstanceType KeyName: !If [ KeyPairNameProvided, !Ref KeyPairName, !Ref 'AWS::NoValue' ] -- cgit v1.2.3