当使用 AWS CDK 部署时,如果存在多个堆栈,则需要提供堆栈名称作为参数。
下面是一个示例,假设有两个堆栈:StackOne 和 StackTwo。
在没有指定堆栈名称参数的情况下尝试部署:
cdk deploy
此时会出现以下错误信息:
Stack ARN not found for the stack in the environment StackOne
Stack ARN not found for the stack in the environment StackTwo
This deployment will make no changes to the stack(s).
解决方法是在部署时指定堆栈名称作为参数,例如:
cdk deploy StackOne StackTwo
这样就可以成功地部署两个堆栈了。