Update your stack template - AWS CloudFormation (original) (raw)

To modify the resources or properties in a CloudFormation stack, you must update the stack's template. Start with the existing template for that stack and make your changes to it. If you have the template stored in a source control system, use a copy of that as your starting point. Otherwise, you can get a copy of the template from CloudFormation.

If you only want to change the parameters or settings of the stack (like a stack's Amazon SNS topic), you can reuse the existing template without getting a copy.

You can update a CloudFormation stack template by using a text editor or Infrastructure Composer.

To update an existing stack template by using Infrastructure Composer
  1. Sign in to the AWS Management Console and open the AWS CloudFormation console athttps://console.aws.amazon.com/cloudformation.
  2. On the Stacks page, choose the name of the stack to update.
  3. Choose the Template tab, and then choose View in Infrastructure Composer.
    CloudFormation opens the template in Infrastructure Composer.
  4. Update your template using one of the following methods:
    • Canvas interface: Here, you can drag and drop from theResources pallete. Configure resources by double-clicking on a card to open the Resource properties panel. Connect resources as needed. For detailed instructions on using theCanvas interface, see How to compose in AWS Infrastructure Composer.
    • Template interface: Switch from theCanvas to the Template interface. Make in-line updates to the template code. Toggle between JSON to YAML formats as needed.
  5. Choose Validate to check for any syntax errors in the template.
  6. When you are ready to export changes to CloudFormation, choose Update template.
To update an existing stack template by using the AWS CLI
  1. To get the template for the stack you want to update, use the get-template CLI command.
  2. Copy the template, paste it into a text file, modify it, and save it. Copy_only_ the template. The command encloses the template in quotation marks, but don't copy the quotation marks surrounding the template. The template itself starts with an open brace and ends with the final close brace. Specify changes to the stack's resources in this file.

Keep in mind the following points as you make changes to your template:

Note

Sometimes CloudFormation won't allow certain changes you try to make, and it will tell you the change isn't permitted. This message might occur asynchronously, however, because resources are created and updated by CloudFormation in a non-deterministic order by default.