Sharing Configurations
In this lesson, you'll study how to share configurations among Lambda functions.
We'll cover the following...
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 200 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 200 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 200 variables, don’t create a single CloudFormation template with 200 resources ...