#
Update a Value in a Nested Stack
#
Overview
When you need to modify a resource property within a nested CloudFormation stack, you cannot simply edit the nested stack directly. While the change would apply immediately, the parent stack still references the old template URL. The next time the parent stack updates, it will use that old template and overwrite all of your changes.
To make a persistent change to a nested stack, you must:
- Edit the nested stack template using AWS Infrastructure Composer to generate a new template hosted on S3
- Copy the S3 URL of the modified template
- Update the parent stack to reference the new template URL
This ensures that future parent stack updates will use your modified template instead of reverting to the old one.
#
Prerequisites
Before starting, gather the following information:
- AWS Account ID: Locate this in the deployment organization's settings page.
- Deployment ID: Found in the deployment's settings page.
- Nested Stack Name: Know which nested stack contains the resource you need to modify (e.g.,
LayerAwsDatabase,LayerJrcNetwork, etc.).
Log in to the production SSO account, and assume the ProdAutoPilotSupportLevelTwo role (or higher) in the correct AWS account.
#
Locate The Nested Stack
- Open the CloudFormation service in the AWS console.
- Filter stacks by typing
jrc-followed by the deployment ID. - Select the nested stack that contains the resource you need to modify.
#
Generate a Modified Template URL
- Click Update stack followed by Make a direct update.
- You will be prompted that you are editing a nested stack. Confirm and continue.
- Choose the Edit in Infrastructure Composer option and click the Edit in Infrastructure Composer button.
- In the Infrastructure Composer, navigate to the Template tab. You should see the template in YAML format.
- Make your desired changes to the template (e.g., remove a property, change a value, etc.).
- Click the Update template button and confirm by clicking Confirm and continue to CloudFormation.
- Copy the URL from the Amazon S3 URL field and save it for the following steps.
warning
Do not proceed with updating the nested stack directly. The goal of this step is only to generate the modified template URL.
#
Cancel The Nested Stack Update
- Stop the update process on the nested stack.
- Navigate back to the CloudFormation console.
#
Locate The Parent Stack
- Filter stacks again by typing
jrc-followed by the deployment ID. - Select the root/parent stack of the deployment (this is the stack without nested stack indicators).
- To simplify the search, you can untoggle the View nested switch.
#
Update The Parent Template
- Click Update stack followed by Make a direct update.
- Choose the Edit in Infrastructure Composer option and click the Edit in Infrastructure Composer button.
- In the Infrastructure Composer, navigate to the Template tab. You should see the template in JSON format.
danger
Do not convert the template to YAML. AutoPilot requires JSON format, and converting from YAML can introduce discrepancies that prevent the deployment page from loading correctly.
- Locate the nested stack resource in the template (e.g.,
LayerAwsDatabase,LayerJrcNetwork). - Replace the
TemplateURLproperty of that resource with the URL you copied earlier. - Click the Update template button and confirm by clicking Confirm and continue to CloudFormation.
#
Apply The Changes
- Continue updating the stack by clicking Next.
- Review the changes and click Submit.
- Wait for the stack update to complete.
#
Verify Changes
After the stack update completes:
- Navigate to the nested stack in CloudFormation.
- View the template to confirm your changes were applied.
- Check the relevant AWS service (e.g., RDS, EC2) to verify the resource reflects the expected state.