Scale Your Templates Using Macros, Nested Stacks, and Modules
Sometimes, when we work with templates, we want to dynamically assign values to resources or alter the template quickly during stack operations. Sometimes, we want to have a modular structure for our stacks and enhance reusability.
One of the most well-known template macros is the Serverless Application Model (SAM), which is a simplified CloudFormation template for serverless applications (we will cover SAM in the next few chapters). Another well-known macro is AWS::Include
, which allows us to append the CloudFormation template with boilerplate snippets. When it comes to reusability and modularity, we can use nested stacks or register CloudFormation module extensions.
In this chapter, we will learn about template macros and their use cases, and we will develop our own macros. Later, we will take a quick look at nested stacks, examining why they are used way less than before and why modules have succeeded them. Finally...