Create a change set for a CloudFormation stack - AWS CloudFormation

Create a change set for a CloudFormation stack

To create a change set for a running stack, submit the changes that you want to make by providing a modified template, new input parameter values, or both. CloudFormation generates a change set by comparing your stack with the changes you submitted.

You can either modify a template before creating the change set or during change set creation.

Create a change set (console)
To create a change set
  1. Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation.

  2. On the navigation bar at the top of the screen, choose your AWS Region.

  3. On the Stacks page, choose the running stack you want to create a change set for.

  4. In the stack details pane, choose Stack actions, and then choose Create change set for current stack.

  5. On the Create change set for stack-name page, do one of the following to modify input parameter values, specify the location of an updated template, or modify the template:

    Task Action
    To modify input parameter values Choose Use existing template, and then choose Next to proceed to enter or modify input parameter values.
    To specify the location of an updated template

    If you've modified the template, choose Replace existing template, and then do one of the following:

    • For a template stored in an Amazon S3 bucket, choose Amazon S3 URL. Enter or paste the URL for the template, and then choose Next.

      If you have a template in a versioning-enabled bucket, you can specify a specific version of the template by appending ?versionId=version-id to the URL. For more information, see Working with objects in a versioning-enabled bucket in the Amazon Simple Storage Service User Guide.

    • For a template stored locally on your computer, choose Upload a template file. Choose Choose File to navigate to the file and select it, and then choose Next.

    To modify the template If you haven't modified the template, choose Edit template in Infrastructure Composer, and then choose Edit in Infrastructure Composer. You're redirected to the AWS Infrastructure Composer. Once you've modified the template, choose Create change set and then Confirm and continue to CloudFormation to return to the Create change set for stack-name page, and then choose Next.
  6. On the Specify stack details page, specify a name for the change set and optionally specify a description of the change set to identify its purpose in the Overview section. If your template contains parameters, on the Specify stack details page, enter or modify applicable input parameter values, and then choose Next.

    If you're reusing the stack's template, CloudFormation populates each parameter with the current value in the stack, with the exception of parameters declared with the NoEcho attribute. To use existing values for those parameters, select Use existing value.

    For more information about using NoEcho to mask sensitive information, and using dynamic parameters to manage secrets, see the Do not embed credentials in your templates best practice.

  7. On the Configure stack options page, update the stack's tags, IAM service role, stack policy, rollback configuration, Amazon SNS notification topic (if applicable), or change sets.

    Note

    Change sets for nested stacks are Enabled by default, which will create change sets for all nested stacks specified in your template. To create a change set for the current stack only, choose Disabled. For more information about change sets for nested stacks, see Change sets for nested stacks.

  8. If the template includes IAM resources, for Capabilities, choose I acknowledge that CloudFormation might create IAM resources. IAM resources can modify permissions in your AWS account; review these resources to ensure that you're permitting only the actions that you intend. For more information, see Acknowledging IAM resources in CloudFormation templates.

  9. Choose Next to continue.

  10. On the Review stack-name page, review the changes for this change set.

  11. Choose Submit.

    You're redirected to the Changes tab of the change set's details page. While CloudFormation generates the change set, the status of the change set is CREATE_PENDING. After it has created the change set, CloudFormation sets the status to CREATE_COMPLETE. In the Changes section, CloudFormation lists all of the changes that it will make to your stack. For more information, see View a change set for a CloudFormation stack.

    Choose View details in the Property-level changes column to view changes made at the property-level.

    If CloudFormation fails to create the change set (reports FAILED status), fix the error displayed in the Status field, and then recreate the change set.

  12. After confirming the changes look correct, choose Execute change set

Create a change set for nested stacks (console)
To create a change set for nested stacks
  1. Open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation.

  2. On the navigation bar at the top of the screen, choose your AWS Region.

  3. On the Stacks page, select the running stack you want to create a change set for.

  4. In the stack details pane, choose Stack actions, and then choose Create change set for current stack.

  5. On the Create change set for stack-name page, do one of the following to modify input parameter values, specify the location of an updated template, or modify the template:

    Task Action
    To modify input parameter values Choose Use existing template, and then choose Next to proceed to enter or modify input parameter values.
    To specify the location of an updated template

    If you've modified the template, choose Replace existing template, and then do one of the following:

    • For a template stored in an Amazon S3 bucket, choose Amazon S3 URL. Enter or paste the URL for the template, and then choose Next.

      If you have a template in a versioning-enabled bucket, you can specify a specific version of the template by appending ?versionId=version-id to the URL. For more information, see Working with objects in a versioning-enabled bucket in the Amazon Simple Storage Service User Guide.

    • For a template stored locally on your computer, choose Upload a template file. Choose Choose File to navigate to the file and select it, and then choose Next.

    To modify the template If you haven't modified the template, choose Edit template in Infrastructure Composer, and then choose Edit in Infrastructure Composer. You're redirected to the AWS Infrastructure Composer. Once you've modified the template, choose Create change set and then Confirm and continue to CloudFormation to return to the Create change set for stack-name page, and then choose Next.
  6. On the Specify stack details page, specify a name for the change set and optionally specify a description of the change set to identify its purpose in the Overview section. If your template contains parameters, on the Specify stack details page, enter or modify applicable input parameter values, and then choose Next.

    If you're reusing the stack's template, CloudFormation populates each parameter with the current value in the stack, with the exception of parameters declared with the NoEcho attribute. To use existing values for those parameters, select Use existing value.

    For more information about using NoEcho to mask sensitive information, as well as using dynamic parameters to manage secrets, see the Do not embed credentials in your templates best practice.

  7. On the Configure stack options page, update the stack's tags, IAM service role, stack policy, rollback configuration, Amazon SNS notification topic (if applicable), or change sets.

    Note

    Change sets for nested stacks are Enabled by default, which will create change sets for all nested stacks specified in your template. For more information about change sets for nested stacks, see Change sets for nested stacks.

  8. If the template includes IAM resources, for Capabilities, choose I acknowledge that CloudFormation might create IAM resources. IAM resources can modify permissions in your AWS account; review these resources to ensure that you're permitting only the actions that you intend. For more information, see Acknowledging IAM resources in CloudFormation templates.

  9. Choose Next to continue.

  10. On the Review stack-name page, review the changes for this change set.

  11. Choose Submit.

    Note

    CloudFormation property-level change sets does not resolve cross-stack references when you create change sets for nested stacks. Change sets can mark resources in a child stack for conditional replacement if they reference the output of a parent stack, and the parent stack has been modified

    You're redirected to the Changes tab of the change set's details page. While CloudFormation generates the change set, the status of the change set is CREATE_PENDING. After it has created the change set, CloudFormation sets the status to CREATE_COMPLETE. In the Changes section, CloudFormation lists all of the changes that it will make to your stack. For more information, see View a change set for a CloudFormation stack.

    If CloudFormation fails to create the change set (reports FAILED status), fix the error displayed in the Status field, and then recreate the change set.

  12. After confirming the changes look correct, choose Execute change set

To create a change set (AWS CLI)
  • Run the create-change-set command.

    You submit your changes as command options. You can specify new parameter values, a modified template, or both. For example, the following command creates a change set named SampleChangeSet for the SampleStack stack. The change set uses the current stack's template, but with a different value for the Purpose parameter:

    aws cloudformation create-change-set \ --stack-name arn:aws:cloudformation:us-east-1:123456789012:stack/SampleStack/1a2345b6-0000-00a0-a123-00abc0abc000 \ --change-set-name SampleChangeSet --use-previous-template \ --parameters \ ParameterKey="InstanceType",UsePreviousValue=true ParameterKey="KeyPairName",UsePreviousValue=true ParameterKey="Purpose",ParameterValue="production"