Search⌘ K
AI Features

Sharing Configurations

Explore strategies to share configurations in AWS Lambda serverless applications. Understand the limitations of single SAM templates and discover how nested stacks, stack exports, and parameter stores can help manage configuration for large or multi-team deployments effectively.

Problem with a single configuration

Related functions often need to share configurations, such as names of AWS resources or access keys to external services. In this course, you kept all the functions in a single SAM template and configured them using environment variables. Using a single template makes it easy to ensure that everything is configured consistently. This is great for simple examples but only works if an entire application fits into a single SAM template. There are several reasons why a single template might not be the best option.

A single CloudFormation stack can only create 500 resources. With SAM, that number is actually even lower, because SAM works as a CloudFormation transformation, so each AWS::Serverless::Function block translates into several resources. An application requiring more than 500 resources will need more than one template.

First of all, large YAML files get difficult to maintain and are difficult to read. If you wouldn’t create a single source code file with 500 variables, don’t create a single CloudFormation template with 500 resources just because you can. In the same way that you’d split a large ...