SAM Serverless Stack Lifecycle
Build, package, and deploy a SAM serverless application (Lambda + API Gateway + DynamoDB), then configure a Canary10Percent5Minutes deployment with CloudWatch alarm and watch CodeDeploy auto-rollback in action.

Lab Overview
In this lab you'll go end-to-end with the AWS Serverless Application Model (SAM). You'll scaffold a Lambda + API Gateway + DynamoDB application, build it with `sam build`, deploy it with `sam deploy`, and then add a `DeploymentPreference` of `Canary10Percent5Minutes` with a CloudWatch alarm. You'll deploy a v2 of the function and finally trigger the alarm to demonstrate automatic CodeDeploy rollback.
You will:
- Initialize a SAM template with a Lambda function, API Gateway endpoint, and DynamoDB table
- Run `sam build` and inspect the `.aws-sam/` build artifacts
- Deploy the stack with `sam deploy --guided` and invoke the API
- Add a `DeploymentPreference` (Canary10Percent5Minutes) plus CloudWatch alarm
- Deploy a v2 of the function and watch the canary shift traffic
- Tighten the alarm threshold to force CodeDeploy to roll back the deployment
What You'll Learn
Initialize a SAM application with Lambda, API Gateway, and DynamoDB
Build and inspect SAM build artifacts in .aws-sam/
Deploy a SAM stack with sam deploy and verify the API endpoint
Configure a Canary10Percent5Minutes DeploymentPreference with a CloudWatch alarm
Trigger a CloudWatch alarm to force CodeDeploy automatic rollback
Prerequisites
aws-devops-cli-operations-baseline
basic-cloudformation-familiarity
basic-lambda-familiarity
Technologies Covered
Part of a Course
This lab is part of the AWS Certified DevOps Engineer - Professional (DOP-C02) course
View All CoursesChoose your plan
Simple, Transparent Pricing
Unlock full access to TeKanAid courses, labs, and bootcamps
Pro
Course content without labs
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Full access to all courses
- Progress tracking
- Certificate of completion
- Community access
- Bootcamp participation
- New content access
Premium
Full access with hands-on labs
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Everything in Pro
- Unlimited hands-on labs
- Lab AI Assistant
- Accelerator bootcamps with live office hours
- Priority support
Prefer a single course?
Purchase individual courses for a one-time fee of $79. Full access to course content, quizzes, certificates, and community features, lab access is not included.
Browse CoursesTry it free, no credit card
Three free ways to start. All bridge into the paid Premium catalog when you're ready.
Not ready to commit? The crash course is email-only. No academy account required.
Ready to Get Started?
Start this hands-on lab and build real-world Platform Engineering skills
Get Access Now