Registry / aws / aws-sam-cli

aws-sam-cli

JSON →
library1.165.0pypypi✓ verified 24d ago

The AWS Serverless Application Model (SAM) Command Line Interface (CLI) is an open-source tool that enables developers to build, test, debug, and deploy serverless applications defined by the AWS SAM specification. It provides a local Lambda-like execution environment and integrates with container tools like Docker and Finch for local development. Currently at version 1.158.0, it maintains a frequent release cadence with updates typically occurring weekly or bi-weekly.

pip install aws-sam-cli
INSTALL
IMPORT
SIG · AWS-SAM-CLI
A
aws-sam-cli
awspythonv1.165.0
Install
28.3s avg
Import
Disk
323MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 286.7MB
glibc
py 3.103.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.
fix
Upgrade 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.
fix
Install 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.
fix
Upgrade 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.
fix
Avoid 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.
fix
Always 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.
fix
Use `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.
Agent activity
29 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources
aws-sam-cli — pip install aws-sam-cli · libregistry