Search code examples
amazon-web-servicesaws-cloudformationchangeset

How to create new stack using create-change-set in AWS Cloudformation


I'm able to use change-sets on an existing AWS stack. I read this doc and it seems it's also possible to create a change set for a new stack.

Now I try to do it using the CLI:

aws cloudformation create-change-set --change-set-name ChangeSet-82 --stack-name test-bucket-xx --region eu-west-1 --template-body file://xxx

This returns an error:

An error occurred (ValidationError) when calling the CreateChangeSet operation: Stack [test-bucket-xx] does not exist.

What am I missing here?


Solution

  • The type of change set operation. To create a change set for a new stack, specify CREATE. To create a change set for an existing stack, specify UPDATE .

    --change-set-type CREATE
    

    Source

    To create a change set for a stack that doesn't exist, for the change-set-type parameter, specify CREATE . To create a change set for an existing stack, specify UPDATE for the change-set-type parameter. After the create-change-set call successfully completes, AWS CloudFormation starts creating the change set. To check the status of the change set or to review it, use the describe-change-set action.