AWS CloudFormation Separate Resources in Files

0

I want to use AWS CloudFormation and to separate my stack resources into different files without using nested stacks, How can i achieve this so as to make my template neat and structure as it could have over 50 - 100 resources.

Example in YAML [MainTemplete.yaml]

  1. Resource1.yaml
  2. Resource2.yaml
  3. Resource3.yaml
  4. Resource4.yaml
  5. Resource5.yaml

if posible Resource5.yaml to include

  1. Sub1Resource5.yaml
  2. Sub2Resource5.yaml
  3. Sub3Resource5.yaml

and also able to share parameters and resources. Thank you.

1 Answer
1
Accepted Answer

I think the closest thing out-of-box is AWS::Include transform. However it won't allow you to do multiple levels of includes and it isn't a work-a-round for single template size limit as includes are processed before template is deployed. Make sure you check Remarks -section at below URL

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/create-reusable-transform-function-snippets-and-add-to-your-template-with-aws-include-transform.html

If you want more professional software development features with Cloudformation, CDK might be an option?

profile picture
EXPERT
Kallu
answered 8 months 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.

Guidelines for Answering Questions