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.

AI CLI·25 commands·Last updated 2026-08-23

Install & Auth 5

brew install amazon-q
Install Q CLI on macOS via Homebrew
q --version
Show installed version
q login
Sign in with AWS Builder ID / IAM Identity Center
q logout
Sign out of the current session
q config list
Show current config (profile/region)

Chat & Query 5

q chat
Start 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 /doc
Generate doc comments for current code
q /test
Generate unit tests for selected code

Agent Mode 5

Inside q chat, type /q
Enter autonomous agent mode for multi-step tasks
Describe the full requirement in agent
Cross-file edits, run commands, self-check
/clear
Clear conversation history
Ctrl+C
Interrupt current generation/execution
q chat --help
Show 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-1
Set the target region
q /help
List available slash commands

Tips 5

One-line q "..." fits scripts/CI
Print mode pipes directly
q login before chat
Make sure AWS identity is ready
Use /doc /test to skip boilerplate
One-click docs and tests
Agent mode for multi-step refactor
/q autonomously edits across files
Best with AWS context
Q 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 Us

Edit this page on GitHub

Edit the source file directly and open a PR to improve this cheatsheet.