Infrastructure as Code
Explore how AWS CloudFormation enables infrastructure as code by converting YAML templates into cloud resource stacks. Learn the benefits of using this approach for deploying, updating, and managing serverless applications safely and efficiently. Understand the role of AWS SAM transformations that simplify resource definitions for Lambda functions, API Gateway, and DynamoDB tables. This lesson helps you grasp how to maintain infrastructure versioning and collaborate on serverless projects with reusable templates.
The CloudFormation template #
For deploying applications, SAM uses CloudFormation, an AWS service for managing infrastructure as code. This means that CloudFormation converts a source file describing an application infrastructure (called template) into a set of running, configured cloud resources (called stack).
Instead of individually configuring different resources such as file storage, databases, and queues with CloudFormation, you just need to declare the required resources in a textual file. The template.yaml file in your project directory is a CloudFormation template.
The CloudFormation stack #
You can use CloudFormation to create a whole stack of resources from the template in a single command. It is also smart enough to detect the differences between a template and a deployed stack, making it easy to update infrastructure resources in the future.