aws-cdk: ECS parameter last modified date does not match
❓ ECS parameter last modified date does not match
The Question
cdk deploy stops when creating the change set with the following error:
Parameters: [ssm:/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id:58:1618452653926] last modified date does not match with the last modified date of the retrieved parameters.

Yesterday it was still working. I did not change anything.
The ECS configuration is nothing fancy:
from aws_cdk import aws_ecs as ecs, aws_ec2 as ec2, core
class Ecs:
def __init__(self, stack: core.Stack, vpc: ec2.Vpc):
self.cluster = ecs.Cluster(
stack,
"EcsCluster",
vpc=vpc,
)
self.cluster.add_capacity(
"EcsCluserCapacity",
instance_type=ec2.InstanceType.of(
instance_class=ec2.InstanceClass.BURSTABLE3,
instance_size=ec2.InstanceSize.SMALL,
),
allow_all_outbound=True,
vpc_subnets=ec2.SubnetSelection(subnet_type=ec2.SubnetType.PRIVATE),
)
If you have an idea or need more information, please let me know 😃
Environment
- CDK CLI Version: 1.101.0 (build 149f0fc)
- Module Version: aws-cdk.aws-ecs==1.101.0
- Node.js Version: v12.16.0
- OS: OSX Big Sur 11.2.1
- Language: Python
Other information
ApiStagingStack failed: Error: Failed to create ChangeSet cdk-deploy-change-set on ApiStagingStack: FAILED, Parameters: [ssm:/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id:58:1618452653926] last modified date does not match with the last modified date of the retrieved parameters.
at /Users/tobiasnawa/.nvm/versions/node/v12.16.0/lib/node_modules/aws-cdk/lib/api/util/cloudformation.ts:227:11
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at waitFor (/Users/tobiasnawa/.nvm/versions/node/v12.16.0/lib/node_modules/aws-cdk/lib/api/util/cloudformation.ts:188:20)
at Object.waitForChangeSet (/Users/tobiasnawa/.nvm/versions/node/v12.16.0/lib/node_modules/aws-cdk/lib/api/util/cloudformation.ts:213:15)
at Object.deployStack (/Users/tobiasnawa/.nvm/versions/node/v12.16.0/lib/node_modules/aws-cdk/lib/api/deploy-stack.ts:260:32)
at CdkToolkit.deploy (/Users/tobiasnawa/.nvm/versions/node/v12.16.0/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:180:24)
at initCommandLine (/Users/tobiasnawa/.nvm/versions/node/v12.16.0/lib/node_modules/aws-cdk/bin/cdk.ts:209:9)
Failed to create ChangeSet cdk-deploy-change-set on ApiStagingStack: FAILED, Parameters: [ssm:/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id:58:1618452653926] last modified date does not match with the last modified date of the retrieved parameters.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 11
- Comments: 25 (8 by maintainers)
So it seems like this is related to the new cloudformation feature for dynamic parameter references https://aws.amazon.com/about-aws/whats-new/2021/04/now-reference-latest-aws-systems-manager-parameter-values-in-aws-cloudformation-templates-without-specifying-parameter-versions/.
We are removing the usage of this feature in the next cdk release which should prevent stacks from getting into this state and are working with cloudformation on a solution to the stacks that are currently stuck. Will provide updates here as they come.
Run
cdk synthand update stack manually using generated CFN template through AWS console (update stack, not create changeset). After that it will work.I have been plagued by this issue recently too. Luckily the work has been in dev so I can just delete and recreate the stack, but I don’t want to have to do that in production.
One thing I’ve noticed which may be helpful in troubleshooting is that when I hit this issue, it takes a very long time in the “creating CloudFormation changeset” step. Normally this happens in seconds. When I hit this error, that step takes closer to 5 minutes.
It’s a bug in latest CDK version. I’ve downgraded my CDK to 1.100.0 and it works. It’s broken in 1.101.0.