对CloudFormation上的嵌套堆栈使用CAPABILITY_AUTO_EXPAND

Tan*_*ong 11 aws-cloudformation aws-codepipeline

我试图使用嵌套堆栈,当我的ChangeSet被执行时,我收到此错误:

Requires capabilities : [CAPABILITY_AUTO_EXPAND]

我去创建了一个带有cloudformation的管道.

这可以用于创建管道:

Configuration:
  ActionMode: CHANGE_SET_REPLACE
  ChangeSetName: changeset
  RoleArn: ??
  Capabilities: CAPABILITY_IAM
  StackName: appsync-graphql
  TemplatePath: BuildArtifact::output.yaml
Run Code Online (Sandbox Code Playgroud)

这不能:

Configuration:
  ActionMode: CHANGE_SET_REPLACE
  ChangeSetName: changeset
  RoleArn: ??
  Capabilities: 
    - CAPABILITY_IAM
    - CAPABILITY_AUTO_EXPAND
  StackName: appsync-graphql
  TemplatePath: BuildArtifact::output.yaml
Run Code Online (Sandbox Code Playgroud)

错误是:"属性值配置必须是具有String(或简单类型)属性的对象"

这是我找到的最接近的文档:https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStack.html

它说:Type: Array of strings对于功能性而言,aws cli docs同样地说,但没有举例说明.

所以我没想到还有什么可以尝试拥有CAPABILITY_AUTO_EXPAND功能.

jba*_*sko 16

我尝试了另一种变体,它有效!

Configuration:
  ..
  Capabilities: CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND
  ...
Run Code Online (Sandbox Code Playgroud)

  • 似乎Pipeline GUI不提供此选项。当我仍在尝试管道时,我只需要快速修复,所以我运行了aws codepipeline get-pipeline --name my-pipeline> tmp.json`,编辑了tmp.json,从底部删除了版本和元数据,设置了“功能”:“ CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND”并通过以下方式重新提交:aws codepipeline update-pipeline --cli-input-json file:// tmp.json` (2认同)

Tan*_*ong 7

我从基顿·霍奇森(Keeton Hodgson)得到了答案,此cli命令有效:

sam deploy --template-file output.yaml --stack-name <AppName> --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND
Run Code Online (Sandbox Code Playgroud)

请注意没有逗号。

我仍然不知道如何更改管道模板以使其正常工作。


Jul*_*n H 5

我尝试了上面的解决方案,今天(2020 年 6 月)使用更高级别对我有用的sam是在列出的功能之间添加一个空格。这个文本文件解释没有弹性,这完全是疯狂的。SAM 的 cli 是开源的,所以我想我可以把我的代码放在我想说的地方并提交 PR。反正。

samconfig.toml

...
capabilities = "CAPABILITY_IAM CAPABILITY_AUTO_EXPAND"
...
Run Code Online (Sandbox Code Playgroud)

然后:

sam deploy

输出:

...
Capabilities               : ["CAPABILITY_IAM", "CAPABILITY_AUTO_EXPAND"]
...
Run Code Online (Sandbox Code Playgroud)