Step-by-Step Guide to Enabling AWS CLI Autocomplete installed via Snap

I installed the aws-cli via snap using
sudo snap install aws-cli --classic
If you’ve also installed AWS CLI using Snap on Ubuntu or other Linux distributions, you may have stumbled upon the same issue that the aws_completer is not placed in the usual /usr/local/bin/aws_completer
🔗 Locate the AWS completer
Lets try to locate the path of aws_completer
which aws_completer return is empty. As no path is shown, locating it using find:
$ find / -name aws_completer 2>/dev/null
/snap/aws-cli/1441/aws/dist/aws_completer
/snap/aws-cli/1441/bin/aws_completer
/snap/aws-cli/1443/aws/dist/aws_completer
/snap/aws-cli/1443/bin/aws_completer
Snap packages use internal versioned folders (e.g. 1441, 1443) that change on update, making hard-coded paths impractical. This makes configuring autocomplete tricky.
However, Snap maintains a /snap/aws-cli/current symlink to the active version. Link this to a location in your $PATH instead.
🛠️ 1. Create a stable symlink in your PATH
Use the snap's current alias to avoid version-specific paths.
This ensures autocomplete continues working even after AWS CLI updates.
sudo ln -sf /snap/aws-cli/current/bin/aws_completer /usr/local/bin/aws_completer
✍️ Step 2: Add completion setup to your shell
For Bash (~/.bashrc):
complete -C '/usr/local/bin/aws_completer' aws
For Zsh (~/.zshrc):
autoload bashcompinit && bashcompinit
autoload -Uz compinit && compinit
complete -C '/usr/local/bin/aws_completer' aws
🔄 Step 3: Reload your shell
Apply changes:
source ~/.bashrc # or source ~/.zshrc
Press Tab after typing a partial aws command:
aws s3 <TAB><TAB>

🤖 Step 4 (Optional): Activate AWS CLI v2 Auto‑Prompt
Beyond tab completion, AWS CLI v2 offers an interactive auto‑prompt that guides your input after pressing Enter
nable it permanently (default profile):
aws configure set cli_auto_prompt on-partial
Or for just your session:
bashCopyEdiexport AWS_CLI_AUTO_PROMPT=on-partial
This mode is especially helpful when you're exploring less familiar commands







