【发布时间】:2021-05-04 08:06:09
【问题描述】:
我刚刚开始我的 serverless/cloudformation/AWS SAM 之旅。我创建了一个具有 AWS::CloudFormation::Stack 类型资源的堆栈,并将我的一些资源分离到该子堆栈中。
当我执行sam build 然后sam deploy 时,我收到以下错误:
Embedded stack arn:aws:cloudformation:us-
west-2:111111111111:stack/ParentStack-
ChildStack-1QK94LXRA71CS/f9885e30-631c-11eb-
bfd8-021cb123b7ed was not successfully created: The
following resource(s) failed to create: [DynamoDBTable].
-
The following resource(s) failed to create:
[ChildStack].
当然,我真正想知道的是嵌套堆栈中的哪个资源创建失败,以及为什么。当我将子堆栈中的资源复制/粘贴到父 .yaml 文件并重建/重新部署时,我看到:
One or more parameter values were invalid: Some index key
attributes are not defined in AttributeDefinitions. Keys:
[userID], AttributeDefinitions: [userId] (Service:
AmazonDynamoDBv2; Status Code: 400; Error Code:
ValidationException; Request ID:
SMJDHUT0CQKM8IBQJVMAIJM4RRVV4KQNSO5AEMVJF66Q9ASUAAJG;
Proxy: null)
这是我在构建父堆栈时希望在输出中看到的:导致子堆栈失败的错误。
这导致我使用了一个相当曲折的工作流程:在主堆栈中构建资源,然后在它们正确构建时将它们分离到一个独立的堆栈中。一定有更好的方法,我相信社区知道一些我不知道的事情。
在 CloudFormation 列车上,你们如何调试子堆栈?
【问题讨论】:
标签: amazon-web-services amazon-cloudformation