How aws/aws-sam-cli works
AWS SAM CLI is a Python command-line tool for creating, locally testing, synchronizing, and deploying serverless applications. The principal workflow starts with a developer invoking a SAM command, which operates on application templates and code to produce local execution, cloud synchronization, or deployment results. Separate command families also initialize projects, configure pipelines, and retrieve logs and traces. The graph includes the documented capabilities and the sampled CLI, provider, and local-runtime layers; internal links are limited to relationships shown in the excerpts or source index.
Main entry points: local_apigw_service.py Local API service · manager.py Container manager · command.py Project initialization · local.py Local commands
Components 18
CLI and context
- SAM CLI entry
samcli/cli/main.py - Command context
samcli/cli/context.py
Templates and providers
- Project initialization
samcli/commands/init/command.py - Template utilities
samcli/commands/_utils/template.py - Application providers
samcli/lib/providers/provider.py - Function provider
samcli/lib/providers/sam_function_provider.py - Stack provider
samcli/lib/providers/sam_stack_provider.py
Local testing
- Local commands
samcli/commands/local/local.py - Local API service
samcli/local/apigw/local_apigw_service.py - Local Lambda service
samcli/local/lambda_service/local_lambda_http_service.py - Container manager
samcli/local/docker/manager.py - Container client
samcli/local/docker/container_client.py
Cloud delivery
- Cloud synchronization
samcli/commands/sync/command.py - Application deployment
samcli/commands/deploy/command.py - Pipeline setup
samcli/commands/pipeline/init/core/command.py
Operations
- Log retrieval
samcli/commands/logs/command.py - Trace retrieval
samcli/commands/traces/command.py
Other components
- Developer
Connections 9
- Developer → Project initialization: initializes projects
- Developer → Local commands: tests locally
- Developer → Cloud synchronization: syncs changes
- Developer → Application deployment: deploys templates
- Developer → Pipeline setup: creates pipelines
- Developer → Log retrieval: tails logs
- Developer → Trace retrieval: views traces
- Local API service → Local Lambda service: invokes function
samcli/local/apigw/local_apigw_service.py - Container manager → Container client: manages containers
samcli/local/docker/manager.py