-
Notifications
You must be signed in to change notification settings - Fork 4k
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
aws-ec2: cdk ignores ReplaceAndDelete always policy in the diff output #32472
Comments
@rantoniuk Good afternoon. Thanks for opening the issue. Unfortunately, using the same stack at my end with CDK version
Thanks, |
CDK updates are done every now and then on the every opportunity when any CDK stack is touched. So answering your question, yes, recently aws-cdk-lib was updated to the current one, but I cannot answer the other part of the question. What you are actually asking is: what was the version, with which this specific stack was last deployed with - and I have no idea.
No, nothing there.
No. On top of that, I looked at CloudFormation's last executed ChangeSet JSON on that stack, this might be helpful:
Especially, notice that part:
Now the question is, why wasn't this shown via |
From the CDK docs for ec2.BastionHostLinux: I'm guessing that a newer release of the AWS AMI for the instance is available, and that is causing the behaviour you see. In my experience in other contexts, a launch template that specifies "always use the latest AMI" does not show any change in Generally, CDK's philosophy seems to be that "versions" of "things" are pinned, so that unexpected resource replacement does not occur. This obviously conflicts with the "always update if possible" requirement for security purposes, and there's not an obvious way to handle that. |
I expect CDK that is an abstraction layer on top of CF to provide accurate deployment-time diff. That's the point of not using the As stated above, CloudFormation had the knowledge of the replacement need - it is available in the CF ChangeSet and CDK could fetch it from there.
Not always. For example, you can deploy an Aurora Serverless RDS where by default minor upgrades are turned on and handled by the PaaS and deploying again wouldn't cause a downgrade. (Whether that's wanted or not is to be decided by the user) |
@rantoniuk Per details shared by you in #32472 (comment), looks like AMI ID of EC2 instance behind the scenes changed. There is also a change in |
Hm this feels like it may be a bit tricky to detect, but I do see why we would want to check this. Unexpected diffs, especially when it comes to the replacement of an instance, can be a bit scary. Gonna discuss with the team |
Describe the bug
Bear with me, as I'm not sure whether this is actually on CloudFormation or CDK side - or in the middle.
I have a
Vpc-Stack
that is defined as follows, that was previously deployed successfully:Now, today,
cdk diff
showed only CDK metadata that would need a REPLACE:However, when doing a subsequent
cdk deploy
, CloudFormation suddenly started to replace an EC2 instance:Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
cdk diff should show accurate resource re-creation information.
Current Behavior
cdk diff
did not show that an EC2 would be replaced during deployment.Reproduction Steps
Code above.
Possible Solution
No response
Additional Information/Context
CDK CLI Version
2.172.0 (build 0f666c5)
Framework Version
No response
Node.js Version
v22.11.0
OS
MacOS
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: