设置 aws cloudformation template-validate 的功能

2024-01-29

我正在尝试验证 Cloudformation 模板。我发出的命令是:

▶ aws cloudformation validate-template --template-body file://template.json

然而,我得到的回应是:

"CapabilitiesReason": "The following resource(s) require capabilities: 
  [AWS::IAM::Role]", 

不幸的是,我找不到任何方法来设置该功能。

你如何设置能力?


The Capabilities and CapabilitiesReason输出来自validate-template http://docs.aws.amazon.com/cli/latest/reference/cloudformation/validate-template.html不是错误。它们是正常的输出,列出了需要指定功能的资源(通过--capabilities)运行时create-stack http://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html or update-stack http://docs.aws.amazon.com/cli/latest/reference/cloudformation/update-stack.html将来。

您可以通过检查以下内容来确认验证是否成功且没有错误返回码 https://docs.aws.amazon.com/cli/latest/topic/return-codes.html is 0表明命令成功完成。

的文档验证模板 http://docs.aws.amazon.com/cli/latest/reference/cloudformation/validate-template.html输出如下:

能力->(列表)

模板中的功能。如果您的模板包含 IAM 资源,您必须指定CAPABILITY_IAM or CAPABILITY_NAMED_IAM当您使用时该参数的值create-stack or update-stack使用您的模板进行操作;否则,这些操作将返回InsufficientCapabilities错误。 有关更多信息,请参阅确认 AWS CloudFormation 模板中的 IAM 资源 http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities.

能力理由->(字符串)

生成功能响应元素中的值的资源列表。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

设置 aws cloudformation template-validate 的功能 的相关文章

随机推荐