sam init adds JSON output
Introduced 2026-09-03 · score 0.90
HOW TO USE IT
When a script needs machine-readable output while creating a SAM project, run `sam init` with `--output json` and all required initialization options; it prints one JSON object after completion.
sam init --no-interactive --runtime python3.13 --name <project-name> --app-template hello-world --output jsonWHY THIS HELPS
Create a SAM project in a script that needs machine-readable initialization output.
REQUIREMENTS AND LIMITATIONS
- Version: v1.166.0
- --no-interactive (required): Disables interactive prompts; required for JSON output.
- --output json (required): Prints one structured JSON object after completion; success includes fields such as project directory and template file, failure includes an `error` object.
- --runtime python3.13 (required): Selects the Lambda runtime; required for non-interactive ZIP initialization when `--location` is not provided.
- --name <project-name> (required): Sets the project directory name; required for non-interactive initialization when `--location` is not provided.
- --app-template hello-world (required): Selects the managed application template; required for non-interactive initialization when `--location` is not provided.
- Prerequisite: Supply all required values for a fully non-interactive run; `--output json` does not work with the interactive workflow.
FIRST-PARTY EVIDENCE
- https://github.com/aws/aws-sam-cli/releases/tag/v1.166.0
- https://docs.aws.amazon.com/en_en/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-init.html
Check the installed version and the source before using it. Entry JSON