7

I installed aws console cli following the instructions here:

http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-set-up.html#install-bundle-other-os

I want to get completion working with zsh. The instructions say to source bin/aws_zsh_completer.sh, which I don't see in the downloaded uncompressed zip installer.

I went ahead and cloned the git repo locally.

Still, sourcing the file doesn't work out of the box. When I attempt to autocomplete, I get python errors complaining about missing modules etc. (e.g., ImportError: No module named awscli.completer)

What am I missing here?

1
  • 1
    I think I managed to get it working but things may have changed in 6 months. I was able to find the .sh file included in the package and sourcing it seemed to work. Maybe time to give it another look. :)
    – Ian Young
    Oct 14, 2014 at 15:13

6 Answers 6

5

I think there might be a misprint in the docs.

The CLI section has the following:

zshsource bin/aws_zsh_completer.sh.

% source /usr/local/bin/aws_zsh_completer.sh

The file aws_zsh_completer.sh doesn't live in /usr/local/bin, but I found it in /usr/local/aws/bin I tried this instead:

% source /usr/local/aws/bin/aws_zsh_completer.sh

I didn't try tcsh but I was able to reproduce the same condition with the bash instructions.

I am using MacOS at the moment, and I haven't had a chance to check this out on my Linux box.

1
  • On newer versions of ubuntu aws can be installed via snap. snap isolates your environment from its packages in /snap, so the completion extension is to be found here /snap/aws-cli/current/bin/aws_zsh_completer.sh.
    – Att Righ
    Jan 21, 2020 at 15:23
3

It seems that the actual location of the file varies from installation to installation, so it's better to find the exact location of the file in your system:

cd /                                                                                              
find -name "aws_zsh*" 
./usr/local/bin/aws_zsh_completer.sh
2

I found out its located here ~/.local/bin/aws_zsh_completer.sh

# add this to your ~/.zshrc 
# aws completion
source  ~/.local/bin/aws_zsh_completer.sh

Reload your terminal. --> Ubuntu 17.10

1

On Ubuntu 17.10 with the awscli package installed:

source /usr/share/zsh/vendor-completions/_awscli
1

What worked for me:

Find the aws_completer:

find / -name aws_completer

Add it to the PATH:

export PATH=/dir/where/aws_completer/is/:$PATH

Load completions:

autoload bashcompinit && bashcompinit
autoload -Uz compinit && compinit
complete -C '$(which aws_completer)' aws
0

Does including aws in plugins section of ~/.zshrc helps?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .