Table of Contents
Introduction
Command-line tab completion speeds up AWS CLI usage and reduces typos. With a few lines in your shell profile, you can enable context-aware completions for services, subcommands, parameters, and even resource ARNs. This guide shows the minimal, reliable setup for both Bash and Zsh on macOS and Linux, including a quick way to find the correct aws_completer path for your system.
Step-by-Step Implementation
1) Confirm AWS CLI installation
aws --version
# Example output (version can vary)
# aws-cli/2.15.0 Python/3.11.6 ...
You need AWS CLI v2 for the best completion experience.
2) Locate aws_completer
command -v aws_completer || type -p aws_completer
Common locations:
- macOS (Apple Silicon, Homebrew):
/opt/homebrew/bin/aws_completer - macOS (Intel, Homebrew):
/usr/local/bin/aws_completer - Linux (AWS CLI v2 installer):
/usr/local/bin/aws_completer
Note the absolute path. Use it in the next steps if command -v doesn’t resolve it automatically.
3) Enable completion for bash
Append the following to your ~/.bashrc (or ~/.bash_profile on macOS if you primarily launch login shells):
# AWS CLI tab completion (bash)
if command -v aws_completer >/dev/null 2>&1; then
complete -C aws_completer aws
elif [ -x "/usr/local/bin/aws_completer" ]; then
complete -C "/usr/local/bin/aws_completer" aws
elif [ -x "/opt/homebrew/bin/aws_completer" ]; then
complete -C "/opt/homebrew/bin/aws_completer" aws
fi
Reload your shell configuration:
# Linux
source ~/.bashrc
# macOS (if using bash_profile)
source ~/.bash_profile
Test it:
aws s<Tab>
# Expect: s3 s3api ssm sso sts ...
4) Enable completion for zsh
Zsh can reuse Bash-style completions via bashcompinit. Append to your ~/.zshrc:
# AWS CLI tab completion (zsh)
autoload -Uz compinit && compinit
autoload -Uz bashcompinit && bashcompinit
if command -v aws_completer >/dev/null 2>&1; then
complete -C aws_completer aws
elif [ -x "/usr/local/bin/aws_completer" ]; then
complete -C "/usr/local/bin/aws_completer" aws
elif [ -x "/opt/homebrew/bin/aws_completer" ]; then
complete -C "/opt/homebrew/bin/aws_completer" aws
fi
Reload and test:
source ~/.zshrc
aws cl<Tab>
# Expect: clearly expanded to 'cloudformation', 'cloudwatch', etc.
5) Optional: make aws_completer discoverable
If it aws_completer isn’t on yours,PATH either add its directory to PATH or hardcode the absolute path in the complete -C line. For example, on Apple Silicon macOS with Homebrew:
# In ~/.zshrc or ~/.bashrc
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
# or
complete -C "/opt/homebrew/bin/aws_completer" aws
6) How it works (at a glance)

Conclusion
Once configured, tab completion dramatically speeds up AWS CLI work and reduces mistakes. Keep your shell’s PATH correct and ensure the complete -C ... aws line loads in every session. If you upgrade or move the AWS CLI, re-check aws_completer path and update your shell profile accordingly.