如何验证或创建 CloudFormation 堆栈

How to validate or create CloudFormation stacks

我添加了 CloudFormation 设置文件 vpc.ymlfront.yml,导出 vpc.yml 中的一些值并导入它们。 我运行下面的命令,但是它不起作用。

$ aws cloudformation validate-template --template-body file://front.yml
An error occurred (ValidationError) when calling the ValidateTemplate operation: Template format error: Unresolved resource dependencies [VPCGatewayAttach] in the Resources block of the template

从其他堆栈导入值的有效命令是什么?

您收到的错误是因为您在指定依赖于 VPCGatewayAttach 的资源之一中具有 dependsOn 属性,但 VPCGatewayAttach 在您的 cft 中不存在。