在构造函数中指定 stackName 和 description 属性来自定义堆栈名称和描述。例如:
const stackName = 'custom-stack-name';
const description = 'Custom description of the stack';
const stack = new cdk.Stack(app, stackName, {
stackName,
description,
env: { account, region },
});
这样,在 AWS CDK 生成 CloudFormation 模板时,堆栈名称和描述将从构造函数中的属性中获取,并显示在 CloudFormation 控制台中。