-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MachineImage: resolveSsmParameterAtLaunch fails CloudFormation #26712
Comments
This means cloudformation does not know if that will be resolved to any imageId because it points to a custom SSM parameter name and we will only know that when a new instance is launched. check out the following documents for more details: Using SSM Parameter with Autoscaling and Launch Template |
I don't get it, if CloudFormation doesn't know about this feature and crashes on it, why put it into CDK? |
If I read the error message correct, then it just means that your ssm parameter has the wrong data type. See here and note the distinction between type and data type. (This tripped me up as well) |
Any updated on this issue? |
For me, it doesn't matter if I use
|
Describe the bug
MachineImage.resolveSsmParameterAtLaunch("...")
does not produce the correctimageId
string required by CloudFormation.As can be seen here:
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ec2/lib/machine-image/machine-image.ts#L259
The string produced is
resolve:ssm:${this.parameterName}${versionString}
when the CloudFormation documentation states it should be{{resolve:ssm:${this.parameterName}${versionString}}}
instead (two extra open and close braces at start and end).CloudFormation Documentation on dynamic SSM parameter references:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html
Expected Behavior
The
imageId
value is produced with the correct syntax and CloudFormation is able to successfully process the value.Current Behavior
CloudFormation currently fails with the following error message:
Reproduction Steps
Use
MachineImage.resolveSsmParameterAtLaunch("any-ssm-parameter-name")
in a LaunchTemplate for an ASG.Possible Solution
Current workaround is to use
MachineImage.fromSsmParameter("any-ssm-parameter-name")
.Additional Information/Context
No response
CDK CLI Version
2.90.0
Framework Version
No response
Node.js Version
18.17.1
OS
Mac M1
Language
Python
Language Version
3.10.11
Other information
No response
The text was updated successfully, but these errors were encountered: