Install & Compatibility
Where this runs
tested against v1.165.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 286.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 28.3s · import 0.000s · 287MB
323MB installed
● package 323MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AWS SAM CLI
✓ This is a command-line interface tool and is not typically imported as a Python library in application code.
The `aws-sam-cli` package provides the `sam` executable for terminal use, not Python modules for direct programmatic import.
This quickstart guides you through initializing a new Python-based 'Hello World' serverless application, building it, testing it locally using `sam local invoke` and `sam local start-api`, and finally deploying it to the AWS Cloud with `sam deploy --guided`. Local testing requires Docker or Finch to be running.
# Initialize a new serverless application (choose 'AWS Quick Start Templates', 'Python 3.x', 'Hello World Example')
sam init --runtime python3.11 --app-template hello-world --name my-sam-app
# Navigate into the project directory
cd my-sam-app
# Build your application (requires Docker or Finch for local container builds)
sam build
# Locally invoke the Lambda function with a sample event
sam local invoke HelloWorldFunction --event events/event.json
# Start a local API Gateway to test your API
sam local start-api
# Deploy your application to AWS Cloud (follow guided prompts)
# Ensure AWS credentials are configured (e.g., via `aws configure` or environment variables)
sam deploy --guided
sam --version
Debug
Known issues
breakingAWS SAM CLI discontinued official support for Python 3.7 as of October 24, 2023. If installed via pip, users on Python 3.7 will be affected. Upgrade your development environment to Python 3.8 or newer.fixUpgrade your local Python environment to 3.8 or newer for SAM CLI installation. This does not affect the Lambda runtime version you can deploy.
affects: <= 1.100.0 (approximately)
gotchaLocal development and testing features (e.g., `sam build`, `sam local invoke`, `sam local start-api`) require a containerization tool like Docker or Finch to be installed and running on your local machine.fixInstall and start Docker Desktop (or Docker Engine) or Finch on your operating system. SAM CLI will automatically detect and use Finch if Docker is not available (as of v1.137.0+).
affects: All versions
breakingSecurity vulnerabilities (CVE-2025-3047 and CVE-2025-3048) related to symlink handling during `sam build` with Docker were found. These could allow unauthorized access to host files.fixUpgrade to AWS SAM CLI v1.134.0 or newer. After upgrading, you *must* re-build your applications using `sam build --use-container` to update symlinks and mitigate the issue. For CVE-2025-3047, use `--mount-symlinks` if you need the previous host-symlink resolution behavior.
affects: <= v1.133.0 (CVE-2025-3047), <= v1.132.0 (CVE-2025-3048)
gotchaWhen using `sam sync` or `sam deploy` across multiple developer environments, explicitly naming resources (e.g., DynamoDB tables) in your `template.yaml` can lead to resource naming conflicts. CloudFormation generates unique names if not specified.fixAvoid explicitly setting resource names in your `template.yaml`. Instead, let CloudFormation generate names based on the stack name and resource logical ID. Pass generated resource names to your Lambda functions via environment variables, e.g., using `!Ref` or `!GetAtt` in your template.
affects: All versions
gotchaThe `.aws-sam/build` directory is an output directory for SAM CLI's build process. Manually modifying files within this directory is not recommended, as changes will be overwritten by subsequent `sam build` commands.fixAlways make changes to your original source code files in your project directory. Run `sam build` to update the `.aws-sam/build` directory with your changes.
affects: All versions
deprecatedThe `sam package` command's functionality is now implicitly included within `sam deploy`. While `sam package` still works, it's generally recommended to use `sam deploy` directly, which handles both packaging and deployment.fixUse `sam deploy` directly, which will automatically package your application artifacts before deployment. If specific packaging parameters are needed, they can often be passed to `sam deploy`.
affects: v1.0.0 onwards, effectively deprecated by `sam deploy` improvements
Upgrade
Version history
1.165.0latest on PyPI · released Jul 31, 2026
Audit
Dependencies
aws-lambda-buildersrequiredUsed for building and packaging AWS Lambda functions for various runtimes and frameworks.
aws-sam-translatorrequiredUsed for transforming SAM templates into CloudFormation templates.