Shell completion makes AWS CLI sessions faster to drive and less error-prone when exploring unfamiliar services, operations, and flags. Pressing Tab against a partial aws command exposes valid choices immediately instead of relying on repeated help lookups or trial-and-error typing.

The feature is powered by the aws_completer program that ships with AWS CLI. The shell loads that helper through a completion rule in the appropriate startup file, so bash, zsh, or tcsh can ask aws_completer for matching service names, operations, and options as commands are typed. In AWS CLI v2, the completer can also suggest some resource values when the active profile and region allow it.

These steps target Linux and macOS shells. The completer path varies by installation method, Amazon Linux on EC2 often enables completion already, and PowerShell on Windows uses a separate profile-based registration method, so the safest workflow is to confirm the installed completer path first and update only the startup file for the shell that actually runs aws.

Steps to enable AWS CLI shell completion:

  1. Confirm that the AWS CLI completer is available in the current shell and note its path.
    $ which aws_completer
    /opt/homebrew/bin/aws_completer

    If no path is returned, locate the binary with find / -name aws_completer 2>/dev/null. Add that folder to PATH or use the absolute path it returns in the completion commands below before continuing.

  2. Check which interactive shell should load the completion rule.
    $ echo $SHELL
    /bin/zsh

    Use ~/.bashrc for bash, ~/.zshrc for zsh, and ~/.tcshrc for tcsh. If echo $SHELL shows the login shell rather than the current one, confirm the active shell with ps -p $$ -o comm=.

  3. Append the completion rule to ~/.bashrc when the active shell is bash.
    $ cat >> ~/.bashrc <<'EOF'
    complete -C '/opt/homebrew/bin/aws_completer' aws
    EOF

    Keep the absolute path returned by which aws_completer if it differs from /opt/homebrew/bin/aws_completer. Login-shell setups should also ensure that ~/.bash_profile or ~/.profile sources ~/.bashrc.

  4. Append the zsh initialization and completion lines to ~/.zshrc when the active shell is zsh.
    $ cat >> ~/.zshrc <<'EOF'
    autoload bashcompinit && bashcompinit
    autoload -Uz compinit && compinit
    complete -C '/opt/homebrew/bin/aws_completer' aws
    EOF

    The bashcompinit loader is required because AWS CLI ships bash-compatible completion logic. Keep the existing compinit setup if ~/.zshrc already initializes completion elsewhere.

  5. Append the completion rule to ~/.tcshrc when the active shell is tcsh.
    $ cat >> ~/.tcshrc <<'EOF'
    complete aws 'p/*/`aws_completer`/'
    EOF

    If the completer is not already in PATH for tcsh, replace aws_completer inside the backticks with the absolute path found in the first step.

  6. Reload the startup file that was updated, or open a new terminal session so the current shell reads the new completion rule.
    $ source ~/.bashrc
    $ source ~/.zshrc
    $ source ~/.tcshrc

    Run only the command that matches the file that was changed. Opening a fresh terminal window avoids sourcing an unrelated shell profile by mistake.

  7. Type a partial AWS CLI command and press Tab to confirm that the shell now offers matching operations.
    $ aws sts g<Tab>
    get-access-key-info
    get-caller-identity
    get-delegated-access-token
    get-federation-token
    get-session-token
    get-web-identity-token

    If no suggestions appear, check the startup file for typos and confirm that the completion rule still points to the installed aws_completer path. On AWS CLI v2, completion can also suggest some resource values after flags such as --table-name when the active profile can query them.