Skip to content

Commit

Permalink
Replaced AMI map with public SSM params so they stay up to date.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Beach committed Aug 12, 2018
1 parent 328e74f commit 57a75c6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 131 deletions.
8 changes: 7 additions & 1 deletion templates/00-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1094,4 +1094,10 @@ Resources:
!Ref HostedZoneName
DomainName:
!Ref DomainName
TemplateURL: https://s3.amazonaws.com/aws-refarch/moodle/latest/templates/05-route53.yaml
TemplateURL: https://s3.amazonaws.com/aws-refarch/moodle/latest/templates/05-route53.yaml

Outputs:
DnsName:
Description: DNS name of the new load balancer for Moodle.
Value:
!GetAtt publicalb.Outputs.PublicAlbDnsName
39 changes: 6 additions & 33 deletions templates/03-bastion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,11 @@ Parameters:
Subnet:
Description: Select existing subnets. The number selected must match the number of subnets above. Subnets selected must be in separate AZs.
Type: List<AWS::EC2::Subnet::Id>

LatestAmiId :
Type : AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: /aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2


Conditions:

NumberOfSubnets1:
Expand Down Expand Up @@ -185,37 +189,6 @@ Conditions:
- !Condition NumberOfSubnets6
Subnet5: !Condition NumberOfSubnets6

Mappings:

RegionMap:
ap-northeast-1:
AMI: ami-da9e2cbc
ap-northeast-2:
AMI: ami-1196317f
ap-south-1:
AMI: ami-d5c18eba
ap-southeast-1:
AMI: ami-c63d6aa5
ap-southeast-2:
AMI: ami-ff4ea59d
ca-central-1:
AMI: ami-d29e25b6
eu-central-1:
AMI: ami-bf2ba8d0
eu-west-1:
AMI: ami-1a962263
eu-west-2:
AMI: ami-e7d6c983
sa-east-1:
AMI: ami-286f2a44
us-east-1:
AMI: ami-55ef662f
us-east-2:
AMI: ami-15e9c770
us-west-1:
AMI: ami-a51f27c5
us-west-2:
AMI: ami-bf4193c7

Resources:

Expand Down Expand Up @@ -258,7 +231,7 @@ Resources:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
IamInstanceProfile: !Ref BastionInstanceProfile
ImageId: !FindInMap [ RegionMap, !Ref 'AWS::Region', AMI ]
ImageId: !Ref LatestAmiId
InstanceMonitoring: true
InstanceType: !Ref BastionInstanceType
KeyName: !Ref EC2KeyName
Expand Down
37 changes: 5 additions & 32 deletions templates/03-efsfilesystem.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ Parameters:
Subnet:
Description: Select existing subnets.
Type: List<AWS::EC2::Subnet::Id>
LatestAmiId :
Type : AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: /aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2


Conditions:

Expand Down Expand Up @@ -198,37 +202,6 @@ Conditions:
UseAWS-ManagedCMK:
!Equals ['', !Ref Cmk]

Mappings:

RegionMap:
ap-northeast-1:
AMI: ami-2a69be4c
ap-northeast-2:
AMI: ami-9bec36f5
ap-south-1:
AMI: ami-4fc58420
ap-southeast-1:
AMI: ami-0797ea64
ap-southeast-2:
AMI: ami-8536d6e7
ca-central-1:
AMI: ami-fd55ec99
eu-central-1:
AMI: ami-c7ee5ca8
eu-west-1:
AMI: ami-acd005d5
eu-west-2:
AMI: ami-1a7f6d7e
sa-east-1:
AMI: ami-f1344b9d
us-east-1:
AMI: ami-8c1be5f6
us-east-2:
AMI: ami-c5062ba0
us-west-1:
AMI: ami-02eada62
us-west-2:
AMI: ami-e689729e

Resources:

Expand Down Expand Up @@ -474,7 +447,7 @@ Resources:
VolumeSize: 10
VolumeType: gp2
IamInstanceProfile: !Ref InstanceProfile
ImageId: !FindInMap [ RegionMap, !Ref 'AWS::Region', AMI ]
ImageId: !Ref LatestAmiId
InstanceMonitoring: true
InstanceType: !Ref InstanceType
KeyName: !Ref EC2KeyName
Expand Down
36 changes: 4 additions & 32 deletions templates/04-efsalarms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ Parameters:
Default: 180
Description: Send warning alarm this many minutes before burst credit balance is zero.
Type: String
LatestAmiId :
Type : AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: /aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2

Conditions:

Expand Down Expand Up @@ -190,37 +193,6 @@ Conditions:
- !Condition NumberOfSubnets6
Subnet5: !Condition NumberOfSubnets6

Mappings:

RegionMap:
ap-northeast-1:
AMI: ami-2a69be4c
ap-northeast-2:
AMI: ami-9bec36f5
ap-south-1:
AMI: ami-4fc58420
ap-southeast-1:
AMI: ami-0797ea64
ap-southeast-2:
AMI: ami-8536d6e7
ca-central-1:
AMI: ami-fd55ec99
eu-central-1:
AMI: ami-c7ee5ca8
eu-west-1:
AMI: ami-acd005d5
eu-west-2:
AMI: ami-1a7f6d7e
sa-east-1:
AMI: ami-f1344b9d
us-east-1:
AMI: ami-8c1be5f6
us-east-2:
AMI: ami-c5062ba0
us-west-1:
AMI: ami-02eada62
us-west-2:
AMI: ami-e689729e

Resources:

Expand Down Expand Up @@ -483,7 +455,7 @@ Resources:
VolumeSize: 10
VolumeType: gp2
IamInstanceProfile: !Ref InstanceProfile
ImageId: !FindInMap [ RegionMap, !Ref 'AWS::Region', AMI ]
ImageId: !Ref LatestAmiId
InstanceMonitoring: true
InstanceType: !Ref InstanceType
KeyName: !Ref EC2KeyName
Expand Down
39 changes: 6 additions & 33 deletions templates/04-web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ Parameters:
Description: The main language used in the Moodle configuration wizard.
Type: String
Default: en
LatestAmiId :
Type : AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
Default: /aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-gp2


Conditions:

Expand Down Expand Up @@ -303,38 +307,7 @@ Conditions:
Subnet5: !Condition NumberOfSubnets6
NoDomainName:
!Equals [ '', !Ref DomainName ]

Mappings:

RegionMap:
ap-northeast-1:
AMI: ami-da9e2cbc
ap-northeast-2:
AMI: ami-1196317f
ap-south-1:
AMI: ami-d5c18eba
ap-southeast-1:
AMI: ami-c63d6aa5
ap-southeast-2:
AMI: ami-ff4ea59d
ca-central-1:
AMI: ami-d29e25b6
eu-central-1:
AMI: ami-bf2ba8d0
eu-west-1:
AMI: ami-1a962263
eu-west-2:
AMI: ami-e7d6c983
sa-east-1:
AMI: ami-286f2a44
us-east-1:
AMI: ami-55ef662f
us-east-2:
AMI: ami-15e9c770
us-west-1:
AMI: ami-a51f27c5
us-west-2:
AMI: ami-bf4193c7


Resources:
WebInstanceProfile:
Expand Down Expand Up @@ -739,7 +712,7 @@ Resources:
ensureRunning: true
Properties:
IamInstanceProfile: !Ref WebInstanceProfile
ImageId: !FindInMap [ RegionMap, !Ref 'AWS::Region', AMI ]
ImageId: !Ref LatestAmiId
InstanceMonitoring: true
InstanceType: !Ref WebInstanceType
KeyName: !Ref EC2KeyName
Expand Down

0 comments on commit 57a75c6

Please sign in to comment.