Deployment, Provisioning, and Automation

A developer moves an AWS CDK resource into a different construct scope without changing its properties. The change set now proposes deleting the existing resource and creating another; how should the developer preserve its CloudFormation identity?

Show the answer

Correct answerD. Override its logical ID with the original value.

AWhy not this: An explicit dependency controls operation order, not resource identity.

BWhy not this: A physical name does not preserve the logical ID and can cause a conflict when CloudFormation attempts creation.

CWhy not this: Stack tags supply metadata and do not determine logical IDs.

DWhy this is right: Keeping the original logical ID preserves CloudFormation's association with the existing resource.

CDK construct paths influence generated logical IDs. Preserving the original logical ID lets CloudFormation recognize the existing resource; keeping only its physical name does not preserve template identity and can cause a naming conflict.