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
Just exploring? Start free below. Want the full experience? Try Premium free for 7 days (card required, $0 today).
Pro
All courses, with lab scripts to run on your own machine
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Full access to all courses
- Lab scripts to download and run on your own machine (hosted labs not included)
- Progress tracking
- Certificate of completion
- Community access
- Self-paced bootcamps
- Premium puzzle library not included (5 free puzzles available)
- New content access
Premium
Full access, including unlimited hosted labs
Renews automatically. Cancel anytime.
Final price verified at checkout.
- Everything in Pro
- Unlimited hands-on labs, fully hosted on TeKanAid Academy (nothing to set up)
- Full access to the puzzle library
- Lab AI Assistant
- 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 CoursesJust exploring? Start free, no account needed
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