Reputation: 32296
This part of cloudformation template works as expected:
Parameters:
LatestAmiId:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
Default: /aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-ebs
But when I changed it to something like this, I get an error:
Parameters:
LatestAmiId:
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
Default: /aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-ebs
AllowedValues:
- /aws/service/ami-amazon-linux-latest/amzn-ami-hvm-x86_64-ebs
- ami-XXadfa6e17bbca4XX
I want to allow 2 values for LastestAmiId field. I will use this value in Properties:
MySpotFleet:
Type: 'AWS::EC2::SpotFleet'
Properties:
SpotFleetRequestConfigData:
LaunchSpecifications:
- ImageId: !Ref LatestAmiId
This works if I keep only 1 SSM Parameter value as shown above. But how do I allow my custom AMI along with default AMI?
Upvotes: 1
Views: 326
Reputation: 238051
Sadly you can't do this, since ami-XXadfa6e17bbca4XX
is not the type of AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
.
You need to have two separate parameters, e.g. LatestAmiId
and LatestAmiId2
with their respective types. Then use conditions in your template to choose between the one which is selected by the user.
Upvotes: 1