Amazon Q Developer CLI Cheatsheet - AWS Official AI Coding Agent Full Reference
All Amazon Q Developer CLI commands in one place — from install & auth to chat/one-line queries, agent mode, and AWS integration — organized by scenario. Copy and go.
Install & Auth 5
brew install amazon-qInstall Q CLI on macOS via Homebrew
q --versionShow installed version
q loginSign in with AWS Builder ID / IAM Identity Center
q logoutSign out of the current session
q config listShow current config (profile/region)
Chat & Query 5
q chatStart the interactive chat REPL
q "write a quicksort in Python"One-line query, print mode (no REPL)
q "explain this error: $(cat error.log)"One-shot query with pipe/variable
q /docGenerate doc comments for current code
q /testGenerate unit tests for selected code
Agent Mode 5
Inside q chat, type /qEnter autonomous agent mode for multi-step tasks
Describe the full requirement in agentCross-file edits, run commands, self-check
/clearClear conversation history
Ctrl+CInterrupt current generation/execution
q chat --helpShow all chat options
AWS Integration 5
q "generate an IAM policy for this Lambda"Generate resource policies with AWS context
q "explain this CloudFormation template"Decode IaC templates
q "migrate this EC2 user-data to SSM"Migration advice and rewrite
q config set region us-east-1Set the target region
q /helpList available slash commands
Tips 5
One-line q "..." fits scripts/CIPrint mode pipes directly
q login before chatMake sure AWS identity is ready
Use /doc /test to skip boilerplateOne-click docs and tests
Agent mode for multi-step refactor/q autonomously edits across files
Best with AWS contextQ knows AWS resources better than general models
Tips
- Amazon Q Developer CLI is AWS-official; when discussing AWS resources (Lambda/IAM/CloudFormation/EC2) it fits cloud context better than general coding agents — great for cloud-native teams.
- One-line `q "..."` uses print mode and pipes straight into scripts/CI; for complex multi-step work, enter `q chat` then `/q` to switch to agent mode.
- Prereq: `q login` with AWS Builder ID or IAM Identity Center; manage profile/region via `q config`.
- /doc and /test are hidden efficiency wins — run them against code to fill in docs and unit tests without writing by hand.
Official References
Commands are compiled from the official docs below. Click to verify the latest usage.
Maintained by LaoHand
Publicly updated on Aug 23, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact UsEdit this page on GitHub
Edit the source file directly and open a PR to improve this cheatsheet.