Skip to content

CloudFormation Nested Stacks

0

Hi AWS, is it possible to create CloudFormation nested-nested stack and if yes, how? I have worked on CloudFormation nested stacks for a long time but yesterday I heard somewhere about CloudFormation nested-nested stack. I haven't found any meaningful blog post around the same so if you can help me understanding the concept, it would be great!

Thanks

1 Answer
0

Yes, it's possible to create nested-nested stacks (also known as multi-level nested stacks) in CloudFormation. This is essentially a nested stack that contains another nested stack, creating a hierarchy of stacks.

Here's a practical example to illustrate the concept:

## Root Stack (parent-stack.yaml)
AWSTemplateFormatVersion: '2010-09-09'
Resources:
  FirstLevelNestedStack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: 'https://s3.amazonaws.com/bucket-name/first-level.yaml'
      Parameters:
        EnvironmentType: 'Production'

## First Level Nested Stack (first-level.yaml)
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
  EnvironmentType:
    Type: String
Resources:
  SecondLevelNestedStack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: 'https://s3.amazonaws.com/bucket-name/second-level.yaml'
      Parameters:
        Environment: !Ref EnvironmentType

AWS
EXPERT

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.