CloudFormation nested stacks outputs limit

1k Views Asked by At

Facts:

  • CloudFormation Outputs limit its 60 per template.
  • I have 90 resources to export so I created the following structure:
    • parent_stack.template (contains the below nested stacks)
    • stack01.template (contains 45 resources and its outputs)
    • stack02.template (contains 45 resources and its outputs)

My issue:

I need to export those 90 resources but I can't export them in parent_stack.template because of the limit.

I can export them in their respective stack01.template and stack02.template but since they are nested when CloudFormation creates them it adds a random alphanumeric string like Stack01-1B0HKOV4YRD6A so I can't actually use the logical name to import from the nested stacks anywhere but in the parent.

I would really appreciate any help here.

Thanks in advance!!!

2

There are 2 best solutions below

1
Perimosh On

You can reference nested output variables. Look at this draft example, this would be like a main cloud formation script:

Description: >
    Some desc

AWSTemplateFormatVersion: 2010-09-09

Resources:

  MyStackA:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: "mystackA.yml"
      Parameters:
        ProjectName: "myprojectA"

  MyStackB:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: "mystackB.yml"
      Parameters:
        ProjectName: "myprojectB"

  MyStackC:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: "mystackC.yml"
      Parameters:
        ProjectName: "myprojectC"
        OutputFromMyStackA: !GetAtt MyStackA.Outputs.myoutputA
        OutputFromMyStackB: !GetAtt MyStackB.Outputs.myoutputB

MyStackC consumes params from MyStackA and MyStackB. MyStackC script will need a parameters section:

Parameters:

  OutputFromMyStackA:
    Description: param from stack a
    Type: String

  OutputFromMyStackB:
    Description: param from stack b
    Type: String

StackA and StackB need to output their own stuff too

Outputs:

  myoutputA:
    Description: the myoutputA
    Value: !Ref SomeStackAResource   ====> this references something inside the script for StackA
0
Maria Ines Parnisari On

Launched in October 2020: https://aws.amazon.com/about-aws/whats-new/2020/10/aws-cloudformation-now-supports-increased-limits-on-five-service-quotas/

Maximum number of outputs that you can declare in your AWS CloudFormation template: 200