How to fix a CloudFormation stack that references an SSM Parameter that's been removed

0

I have a CloudFormation stack that uses Dynamic References of an SSM Parameter.

I was refactoring my stack, so that I could launch multiple copies of them that wouldn't conflict. In the process, I moved the one of the dynamic references, to an input on the stack, and removed the backing SSM Parameter.

Unfortunately, I removed the Parameter before I updated the stack, and now the stack seems to be locked in a weird state. When I try to create a Update the stack with a template with the parameter removed, it creates a Change Set, but the Change Set Fails with the status reason

Parameters: [ssm:<redacted>:1:1694494367727] cannot be found.

I tried creating the SSM Parameter again, but now it fails with

Parameters: [ssm:<redacted>:1:1694494367727] last modified date does not match with the last modified date of the retrieved parameters.

I suspect that I've hit a weird bug in an edge case. Is there any way for me to update my stack without breaking everything?

已提问 2 个月前259 查看次数
1 回答
0

Hi.

This error occurs due to a known bug where CloudFormation when dynamically references SSM parameters, it doesn't pick up the latest timestamp from SSM parameter store.

Here is the recommended workaround to resolve this issue:

  1. Recreate the SSM parameter.

  2. Get the new parameter timestamp using the command $aws ssm get-parameter --name ‘the name of the ssm parameter’. The timestamp is LastModifiedDate. You'll need to convert it to a Unix timestamp with milliseconds. You can do it by pasting the date here and copying the appropriate formatted value.

  3. Copy the processed template entirely and save it to a file (you'll have to edit and upload it later).

  4. Update the template file with the new SSM Parameter (correct the version and the timestamp for the ssm parameter)

  5. In your stack, click Update, choose "Replace current template", and "Upload a template file". Pick the new template file you've just corrected.

  6. Finish the wizard by clicking Next until the last step, and finally click Update stack.

AWS
支持工程师
已回答 2 个月前
profile picture
专家
已审核 2 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容