Defining Serverless Resources
Write SAM templates to define Lambda functions, API Gateway endpoints, DynamoDB tables, and other serverless components.
What are SAM Templates?
AWS Serverless Application Model (SAM) templates are a powerful way to define your serverless applications using Infrastructure as Code (IaC).
Instead of manually configuring resources in the AWS console, you describe them in a YAML or JSON file. This makes your deployments repeatable, version-controlled, and easier to manage.
Anatomy of a SAM Template
A SAM template has a clear structure. The most important parts are:
AWSTemplateFormatVersion: Specifies the template format version.Transform: AlwaysAWS::Serverless-2016-10-31for SAM.Description: A brief description of your application.Resources: Where you define all your AWS components.
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: My First SAM App
Resources:
# Your serverless resources go hereAll lessons in this course
- Introduction to AWS SAM
- Defining Serverless Resources
- Deploying SAM Applications
- Local Testing and Debugging with SAM CLI