Outline updated November 2026
AWS Lambda with Python
Class Duration
14 hours of live training delivered over 2 days.
Student Prerequisites
- Some prior Python experience, such as writing basic scripts, functions, and classes
- Professional programming experience, in Python or another language
- Comfort with the command line and installing developer tools
- No prior AWS Lambda or serverless experience required
Target Audience
- Experienced programmers with some Python experience who are new to AWS Lambda
- Teams adopting serverless Python on AWS who need a short course to get started
- For the Microsoft cloud instead, see Azure Functions with Python
Description
This two-day course is for experienced programmers who know some Python and are new to AWS Lambda. It opens with the Python that serverless code relies on: tooling, type hints, JSON, logging, and testing. Students then write Lambda functions, connect them to API Gateway, S3, and SQS, and deploy them with AWS SAM. Operations topics include CloudWatch logs and metrics, cold starts, and tracing with the AWS Distro for OpenTelemetry (ADOT). The AWS X-Ray SDKs are in maintenance mode, so students also move X-Ray SDK code to OpenTelemetry.
Learning Outcomes
- Read and write idiomatic Python, using its object model and core types such as lists and dictionaries.
- Set up Python environments and manage dependencies with uv and pip.
- Structure code with functions, modules, and dataclasses, and check type hints with mypy.
- Read files, parse JSON, and make HTTP requests from Python.
- Handle errors, add logging, and write unit tests with pytest.
- Explain how Lambda runs a function, which Python runtimes it supports, and its limits and pricing.
- Write a handler that reads the event and context and takes its configuration from environment variables.
- Trigger functions from event sources such as API Gateway, S3, SQS, and EventBridge.
- Package functions as zip archives or container images, share dependencies through Lambda layers, and deploy them as infrastructure as code with AWS SAM.
- Monitor functions with CloudWatch logs, metrics, and traces, and tune them for performance.
- Migrate existing X-Ray SDK tracing to OpenTelemetry.
Training Materials
Students receive the courseware on GitHub: documentation and code samples for every topic in the course. Students practice each topic in hands-on lab exercises.
Software Requirements
Students will need a free, personal GitHub account to access the courseware, a recent Python release, the ability to install Python packages, Visual Studio Code with the ability to install extensions, the AWS CLI, and an AWS account with permission to create Lambda functions and related resources.
Training Topics
Python for Experienced Programmers
- Python compared to other languages
- Dynamic typing, names, and the object model
- Lists, tuples, dictionaries, sets, and strings
- Control flow, comprehensions, and iteration
- Writing idiomatic, readable Python
Python Environments and Tooling
- Installing Python and managing versions
- Virtual environments with uv and pip
- Project layout and packaging basics
- Formatting and linting with Ruff
- Running and debugging in Visual Studio Code
Functions, Modules, and Type Hints
- Defining functions, arguments, and return values
- Modules, packages, and imports
- Type hints and static checking with mypy
- Dataclasses and structured data
- Docstrings and code organization
Working with Data and JSON
- Dictionaries and JSON serialization
- Reading and writing files
- Parsing and validating input data
- Dates, times, and environment variables
- Making HTTP requests from Python
Errors, Logging, and Testing
- Exceptions and error-handling patterns
- The logging module and structured logs
- Writing unit tests with pytest
- Mocking external services
- Practical debugging techniques
Introduction to AWS Lambda and Serverless
- What serverless computing is and when to use it
- The AWS Lambda execution model
- Event functions vs. web functions
- Supported Python runtimes
- Pricing, limits, and quotas
- Lambda within the AWS ecosystem
Building Lambda Functions in Python
- The handler function, event, and context
- Passing input and returning results
- Environment variables and configuration
- Managing dependencies for Lambda
- Reusing connections and initialization code
Triggers and Event Sources
- API Gateway and HTTP APIs
- S3, DynamoDB, and EventBridge events
- SQS and queue-based processing
- Scheduled invocations
- Understanding event payloads
Packaging and Deployment
- Packaging code and dependencies as zip archives
- Lambda layers for shared dependencies
- Container image based functions
- Infrastructure as code with AWS SAM
- IAM roles and least-privilege permissions
Observability and Operations
- Logging to CloudWatch
- Metrics and alarms
- Tracing with OpenTelemetry
- The ADOT Lambda layer for Python
- Viewing traces in CloudWatch and X-Ray
- CloudWatch Application Signals
- Migrating from the X-Ray SDK
- Spans, attributes, and context propagation
- Error handling, retries, and dead-letter queues
- Cold starts and performance tuning