Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use CAPABILITY_AUTO_EXPAND for nested stacks on CloudFormation

I am trying to use nested stack and when my ChangeSet is being executed, I got this error:

Requires capabilities : [CAPABILITY_AUTO_EXPAND]

I went and create a pipeline with cloudformation.

This can be use to create a pipeline:

Configuration:
  ActionMode: CHANGE_SET_REPLACE
  ChangeSetName: changeset
  RoleArn: ??
  Capabilities: CAPABILITY_IAM
  StackName: appsync-graphql
  TemplatePath: BuildArtifact::output.yaml

This can’t:

Configuration:
  ActionMode: CHANGE_SET_REPLACE
  ChangeSetName: changeset
  RoleArn: ??
  Capabilities: 
    - CAPABILITY_IAM
    - CAPABILITY_AUTO_EXPAND
  StackName: appsync-graphql
  TemplatePath: BuildArtifact::output.yaml

The error was: “Value of property Configuration must be an object with String (or simple type) properties”

This is the closest docs that I find: https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_UpdateStack.html

It said: Type: Array of strings for capabilites, and the aws cli docs says similarly, but doesn’t give an example.

So I ran out of ideas about what else to try to have CAPABILITY_AUTO_EXPAND capability.

like image 414
Tan Duong Avatar asked Nov 29 '18 16:11

Tan Duong


People also ask

How do I call nested stack in CloudFormation?

Sign in to the AWS Management Console and open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation/ . Select the stack that you want. Nested stacks display NESTED next to their stack name. On the Overview tab, choose the stack name listed as Root stack.

How do I update nested stack in CloudFormation?

Update the previously created nested stack with a new template. Navigate to Cloudformation service in the AWS console. Select the root stack (it is the one without the nested tag associated). In the top right corner click on Update.

What is the stack Arn on AWS?

The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that's associated with the stack. During a stack operation, AWS CloudFormation uses this role's credentials to make calls on your behalf.


3 Answers

I tried another variant and it worked!

Configuration:
  ..
  Capabilities: CAPABILITY_IAM,CAPABILITY_AUTO_EXPAND
  ...
like image 143
jbasko Avatar answered Oct 26 '22 10:10

jbasko


I got the answer from Keeton Hodgson, this cli command works:

sam deploy --template-file output.yaml --stack-name <AppName> --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND

Notice that there is no comma.

I still don't know how to change the pipeline template for it to work.

like image 32
Tan Duong Avatar answered Oct 26 '22 11:10

Tan Duong


I tried the solutions above and what worked for me today (June 2020) using the higher level sam was adding a space between the capabilities listed. It's complete insanity that there's no resilience in this text file interpretation. SAM's cli is open source so I guess I could put my code where my mouth is and submit a PR. Anyway.

samconfig.toml:

...
capabilities = "CAPABILITY_IAM CAPABILITY_AUTO_EXPAND"
...

Then:

sam deploy

Output:

...
Capabilities               : ["CAPABILITY_IAM", "CAPABILITY_AUTO_EXPAND"]
...
like image 36
Julian H Avatar answered Oct 26 '22 11:10

Julian H