Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Replace static RegionMap #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
48 changes: 5 additions & 43 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ Parameters:
ConstraintDescription: 'Must be in the range [0-8]'
MinValue: 0
MaxValue: 8
LatestAmiId:
Description: 'The Parameter Store Prefix and AMI name alias to Query the latest Amazon Linux AMI from AWS Systems Manager Parameter Store'
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'
Conditions:
HasSSHBastionSecurityGroup: !Not [!Equals [!Ref ParentSSHBastionStack, '']]
HasKeyName: !Not [!Equals [!Ref KeyName, '']]
Expand All @@ -157,48 +161,6 @@ Conditions:
HasTagFiles: !Equals [!Ref TagFiles, 'true']
HasSpotPrice: !Not [!Equals [!Ref SpotPrice, '']]
HasSwapSize: !Not [!Equals [!Ref SwapSize, '0']]
Mappings:
RegionMap:
'af-south-1':
AMI: 'ami-0cec12e29ebe3f0d5'
'eu-north-1':
AMI: 'ami-0653812935d0743fe'
'ap-south-1':
AMI: 'ami-0e306788ff2473ccb'
'eu-west-3':
AMI: 'ami-0de12f76efe134f2f'
'eu-west-2':
AMI: 'ami-0a669382ea0feb73a'
'eu-south-1':
AMI: 'ami-0759301b88845d121'
'eu-west-1':
AMI: 'ami-0bb3fad3c0286ebd5'
'ap-northeast-2':
AMI: 'ami-03b42693dc6a7dc35'
'me-south-1':
AMI: 'ami-08155c9ee8b845e35'
'ap-northeast-1':
AMI: 'ami-0ce107ae7af2e92b5'
'sa-east-1':
AMI: 'ami-02898a1921d38a50b'
'ca-central-1':
AMI: 'ami-0c2f25c1f66a1ff4d'
'ap-east-1':
AMI: 'ami-814d0ff0'
'ap-southeast-1':
AMI: 'ami-015a6758451df3cb9'
'ap-southeast-2':
AMI: 'ami-0f96495a064477ffb'
'eu-central-1':
AMI: 'ami-00a205cb8e06c3c4e'
'us-east-1':
AMI: 'ami-0947d2ba12ee1ff75'
'us-east-2':
AMI: 'ami-03657b56516ab7912'
'us-west-1':
AMI: 'ami-0e4035ae3f70c400f'
'us-west-2':
AMI: 'ami-0528a5175983e7f28'
Resources:
FindingsTopic:
Type: 'AWS::SNS::Topic'
Expand Down Expand Up @@ -1053,7 +1015,7 @@ Resources:
Encrypted: true
IamInstanceProfile:
Name: !Ref ScanInstanceProfile
ImageId: !FindInMap [RegionMap, !Ref 'AWS::Region', AMI]
ImageId: !Ref LatestAmiId
InstanceMarketOptions: !If
- HasSpotPrice
- MarketType: spot
Expand Down