Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

AWS SAM CLI

$ sam Official Med Risk
Amazon Web Services · Cloud & Infra · Apache-2.0 · macos / linux / windows

AWS SAM CLI (sam) builds, validates, locally invokes, and deploys serverless applications defined in SAM/CloudFormation templates, offering sam validate --lint, sam list --output json, and CloudFormation changeset previews via --no-execute-changeset.

FCRS-1.0 Score
82 /100
Good
Medium Confidence
Zero-Friction Install
brew install aws-sam-cli
CLI vs MCP Decision CLI Preferred vs MCP

sam pairs local build/validate workflows with CloudFormation changeset previews directly in the project directory.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
✓ Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 19 / 25

sam list supports --output json and --no-confirm-changeset avoids prompts, though build/deploy emit mostly plain text logs.

  • sam list --output json and --no-confirm-changeset flags
Trust & Safety 21 / 25

sam validate --lint and sam deploy --no-execute-changeset provide reliable pre-flight safety checks.

  • Supports --no-execute-changeset changeset preview
Setup & Portability 12 / 15

Available via Homebrew, PyPI, and official installers, though local container builds require Docker.

  • Homebrew aws-sam-cli and PyPI packages
Utility & Efficiency 12 / 15

Streamlines serverless packaging, local invoke, and deployment in one tool.

  • Unified local test, build, and CloudFormation deploy
Maintenance & Lineage 10 / 10

Official AWS repository (aws/aws-sam-cli) actively maintained under Apache-2.0.

  • Official aws/aws-sam-cli repository
Docs & Verifiability 8 / 10

Good command reference and --help, though many tutorials focus on --guided interactive usage.

  • AWS SAM CLI Developer Guide

Security, Auth & Guardrails

Auth Modes
Config File Env API Key OAuth Browser
Credential Storage

Inherits AWS CLI credentials from ~/.aws/credentials, AWS_PROFILE, or AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY.

Side Effects
Read-Only Local Write Remote Write Destructive Billing Impact
Cost & Quotas

CLI is free (Apache-2.0); deployed Lambda/API Gateway resources incur AWS billing.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# AWS SAM CLI Agent Rules
- Run `sam validate --lint` and `sam build` locally before any deploy command.
- Never run `sam deploy --guided` (interactive); pass `samconfig.toml` or explicit flags + `--no-execute-changeset`.
- Pin `--profile` and `--region` on all remote commands.

Agent-Ready Command Recipes

Safe Read-Only Queries

Validate and lint a SAM template locally
sam validate --lint

Validates CloudFormation/SAM syntax and cfn-lint rules without touching AWS.

List deployed stack resources as JSON
sam list resources --stack-name my-app --output json

Queries deployed stack resources in structured JSON.

Controlled Writes & Previews

Build and preview a CloudFormation changeset without executing
sam deploy --no-execute-changeset --no-confirm-changeset --resolve-s3

Stages a CloudFormation changeset for review without mutating live resources.

Strengths for Agents

  • + sam deploy --no-execute-changeset stages CloudFormation diffs safely.
  • + sam validate --lint catches template errors locally before upload.
  • + Reuses standard AWS CLI profiles and IAM boundaries.

Caveats & Pitfalls

  • ! Avoid sam deploy --guided, which requires interactive TTY input.
  • ! --output json is available on sam list / sam traces but not sam build or sam deploy.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI