Home > Enterprise >  AWS CDK: How to rename existing stacks without losing the ability to update?
AWS CDK: How to rename existing stacks without losing the ability to update?

Time:05-11

I've created and deployed a production stack:

const app = new cdk.App();
const stack = new cdk.Stack(app, 'myorg-production-api');

Now It's important to change the naming schema, and I need this stack to be myorg-api-production-root.

Of course, I can do it by manually destroying the old one, and deploying the new one (both can't exist at the same time, because of the "singleton" resources like DNS records), but this means a huge downtime, which I need to avoid at all cost.

Can I somehow intervene into CDK's stack identity determination process and change stack names without the downtime?

CodePudding user response:

No, it's not possible to change an existing stack's name, either with or without the CDK.

Under the hood, cdk deploy sets the stack name with the CloudFormation CreateChangeSet API (then ExecuteChangeSet) on create. The stack name is a unique, immutable id in CloudFormation.

  • Related