AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Handler: app.handler
Runtime: python3.12
Topics
58
Amazon API Gateway
Amazon Athena
Amazon CloudFront & Content Delivery
Amazon DynamoDB
Amazon ECS (Elastic Container Service)
Amazon EFS (Elastic File System)
Amazon EKS (Elastic Kubernetes Service)
Amazon ElastiCache (Redis & Memcached)
Amazon EventBridge
Amazon Kinesis & Data Streaming
Amazon QuickSight & Business Intelligence
Amazon Redshift & Data Warehousing
Amazon Route 53 & DNS Management
Amazon SageMaker & Machine Learning on AWS
Amazon SNS (Simple Notification Service)
Amazon SQS (Simple Queue Service)
Auto Scaling Groups
AWS AI Services (Rekognition, Polly, Lex & Comprehend)
AWS Backup & Disaster Recovery
AWS Batch
AWS Certificate Manager (ACM)
AWS Certification Paths & Career Roadmap
AWS CLI & SDKs
AWS CloudTrail & Auditing
AWS CodePipeline, CodeBuild & CodeDeploy (CI/CD)
AWS Config
AWS Cost Management & Billing
AWS Database Migration Service & Application Migration
AWS Direct Connect & Hybrid Connectivity
AWS Elastic Beanstalk
AWS Fargate
AWS Free Tier & Account Setup
AWS Global Infrastructure (Regions, AZs & Edge Locations)
AWS Glue & ETL
AWS KMS & Data Encryption
AWS Organizations & Multi Account Strategy
AWS Outposts & Hybrid Cloud
AWS Secrets Manager & Parameter Store
AWS Security Hub & GuardDuty
AWS Serverless Application Model (SAM)
AWS Step Functions
AWS Storage Gateway
AWS Systems Manager
AWS Trusted Advisor
AWS WAF & Shield
Core Services Overview
EC2 & Compute
Elastic Container Registry (ECR)
Elastic Load Balancing (ALB, NLB & CLB)
IaC (CloudFormation)
IAM
Lambda & Serverless
Monitoring (CloudWatch)
RDS & Databases
S3 & Storage
Tagging Strategies & Resource Management
VPC & Networking
Well-Architected Framework
AWS Serverless Application Model (SAM)
7 questions found
AWS SAM, or Serverless Application Model, is an open source framework that provides a simplified shorthand syntax for defining serverless resources like Lambda functions, API Gateway endpoints, and DynamoDB tables, which SAM then automatically transforms into a full CloudFormation template during deployment, letting you define a complete serverless application with significantly less code than writing raw CloudFormation directly.
Real-world example
A developer building a serverless API defines their Lambda function, API Gateway endpoint, and DynamoDB table using SAM's concise syntax, requiring far fewer lines of configuration than would be needed to define the same resources directly in raw CloudFormation.
IaC (CloudFormation);Lambda & Serverless
What is the SAM CLI, and how does it support local testing of serverless applications before deployment?
BeginnerThe SAM CLI is a command line tool that lets you build, test, and debug serverless applications locally on your own machine using Docker to emulate the actual Lambda execution environment, allowing you to invoke functions and test API Gateway endpoints locally before ever deploying anything to AWS, significantly speeding up the development feedback loop compared to deploying to the cloud after every small code change.
sam local invoke MyFunction --event event.json
sam local start-api
Real-world example
A developer building a new Lambda function uses sam local invoke to test their function's logic against a sample event directly on their laptop, catching several bugs before ever deploying the function to an actual AWS environment.
Lambda & Serverless;AWS CLI & SDKs
How does the sam build and sam deploy workflow package and deploy a serverless application to AWS?
IntermediateThe sam build command compiles your application code and its dependencies into a deployment ready format, resolving anything needed for the target Lambda runtime, and sam deploy then packages those build artifacts, uploads them to S3, and executes a CloudFormation deployment using the transformed SAM template, handling the entire process of getting your local application code running as a live set of AWS resources with just these two straightforward commands.
sam build
sam deploy --guided
Real-world example
A team automates their deployment process using sam build followed by sam deploy within their CI/CD pipeline, ensuring every code change that passes tests is automatically packaged and deployed to their AWS environment consistently.
AWS CodePipeline
CodeBuild & CodeDeploy (CI/CD);Lambda & Serverless
How does SAM support defining event sources, such as API Gateway or S3 triggers, directly within a function's configuration?
IntermediateSAM lets you define event sources as a property directly on a serverless function resource, such as specifying an Api event type to automatically create an API Gateway endpoint that triggers the function, or an S3 event type to trigger the function whenever a new object is uploaded to a specific bucket, automatically wiring up all of the necessary underlying permissions and event source configuration without you needing to configure each connected service separately.
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
Events:
ApiEvent:
Type: Api
Properties:
Path: /orders
Method: post
Real-world example
A developer defines a Lambda function in their SAM template with an Api event source pointing to a specific path and HTTP method, and SAM automatically creates and wires up the corresponding API Gateway resource along with all necessary permissions.
Amazon API Gateway;Amazon SQS (Simple Queue Service)
How does SAM support safe, gradual Lambda deployments using traffic shifting and automatic rollback?
IntermediateSAM integrates with CodeDeploy to support gradual traffic shifting deployment strategies for Lambda functions, such as shifting ten percent of traffic to a new function version at a time over several minutes, combined with CloudWatch alarms that automatically trigger a rollback to the previous version if errors increase during the rollout, providing a much safer deployment process than immediately shifting one hundred percent of traffic to an unproven new version.
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
AutoPublishAlias: live
DeploymentPreference:
Type: Canary10Percent5Minutes
Alarms:
- !Ref ErrorAlarm
Real-world example
A payment processing team configures their SAM template to use a canary deployment strategy, automatically rolling back a Lambda function update if error rates spike during the initial ten percent traffic shift, preventing a bad deployment from ever reaching all customers.
Lambda & Serverless;AWS CodePipeline
CodeBuild & CodeDeploy (CI/CD)
How does SAM support nested applications and reusable components through the AWS Serverless Application Repository?
AdvancedSAM applications can be published to the AWS Serverless Application Repository, allowing other teams or even the broader public to easily discover and deploy pre built serverless applications or components as nested applications within their own SAM templates, promoting reuse of common serverless patterns, such as a standard image resizing function, without needing to rebuild the same commonly needed functionality from scratch every time.
Resources:
ImageResizer:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:123456789012:applications/image-resizer
SemanticVersion: 1.0.0
Real-world example
A company building a new application reuses a well tested image resizing function published to the Serverless Application Repository by referencing it as a nested application within their own SAM template, avoiding the need to write and maintain that functionality themselves.
Lambda & Serverless;IaC (CloudFormation)
How can SAM templates be organized and parameterized to support deploying the same serverless application consistently across multiple environments like development, staging, and production?
AdvancedSAM templates support parameters and conditions that let you customize resource configuration based on the target environment, such as using a smaller Lambda memory allocation and a shared development DynamoDB table for a dev environment while using higher memory and dedicated resources for production, combined with separate configuration files for each environment referenced during sam deploy, allowing a single template definition to be reliably deployed consistently with appropriate settings across every environment.
sam deploy --config-env production --parameter-overrides Environment=production MemorySize=512
Real-world example
A development team maintains a single SAM template with environment specific parameter overrides, allowing the exact same application definition to be deployed with smaller resource allocations to their development environment and production grade settings to their production environment.
IaC (CloudFormation);AWS Organizations & Multi Account Strategy