Amazon Q Developer CLI Cheatsheet - AWS Official AI Coding Agent Full Reference
Amazon Q Developer CLI is AWS official terminal AI coding agent, aimed at developers who live in the AWS ecosystem and want the model to understand and edit a local repo while connecting to AWS services/docs. It stands out by deep AWS integration (explaining and acting on AWS resources) and supports both q one-line queries and agent mode. This sheet covers install/login, chat/one-line queries, and agent execution.
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
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
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 Us