A CDK deploy fails because a resource would be replaced and data lost. How do you handle it?
IntermediateScenarioIaC & AWS developer tools (CDK, CodePipeline)
Answer
Check cdk diff for the replacement cause, often a changed logical ID from refactoring or an immutable property. Restore the logical ID with overrideLogicalId or CDK refactoring support, set removalPolicy: RETAIN on stateful resources, and enable termination protection on critical stacks.