skip to Main Content

I want to use the AWS CLI v2 with zsh command completion.

There are instructions here, but they refer to a file aws_zsh_completer.sh which does not exist in the downloaded zip file, nor in /usr/local/aws-cli/v2/current/. Possibly those docs are outdated.

How does one set up zsh completions?

2

Answers


  1. Chosen as BEST ANSWER

    I think the issue is the completion script is missing from the install file. Until that's fixed, I'm using this workaround:

    $ AWSCLI_VERSION=$(aws --version | sed -E 's/^aws-cli/(.+) Python.*/1/')
    $ sudo curl 'https://raw.githubusercontent.com/aws/aws-cli/refs/heads/master/bin/aws_zsh_completer.sh' 
      -o "/usr/local/aws-cli/v2/$AWSCLI_VERSION/dist/aws_zsh_completer.sh"
    $ echo "source /usr/local/aws-cli/v2/$AWSCLI_VERSION/dist/aws_zsh_completer.sh" >> ~/.zshrc
    

    Please upvote the bug report so that they fix the issue.


  2. As per Readme it is manual setup. https://github.com/aws/aws-cli?tab=readme-ov-file#command-completion
    If it is missing in downloaded zip then you can get it from official repo – https://github.com/aws/aws-cli/blob/develop/bin/aws_zsh_completer.sh just add that in your .zshrc like source <path of aws_zsh_completer.sh> and then run source ~/.zshrc

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search