Similar to this question:
How do I get the aws cli completion to work with zsh on ubuntu?
This command from the aws-cli documentation did not properly setup auto completion.
source /usr/local/bin/aws_zsh_completer.sh
Similar to this question:
How do I get the aws cli completion to work with zsh on ubuntu?
This command from the aws-cli documentation did not properly setup auto completion.
source /usr/local/bin/aws_zsh_completer.sh
To run command completion:
Run bashcompinit by adding the following autoload line at the end of your ~/.zshrc profile script.
autoload bashcompinit && bashcompinit
Enable command completion, use the built-in command complete.
complete -C '/usr/local/bin/aws_completer' aws
Add the commands to ~/.zshrc to run it each time you open a new shell.
Test auto completiion
aws sTAB - should display something similar to this: Test Screenshot
For other shells, review this document.
This worked for me:
source /usr/local/share/zsh/site-functions/_aws
$echo 'source /usr/local/share/zsh/site-functions/_aws' >> ~/.zshrc
For MacOS
Find the path of the aws_completer using the command
which aws_completer
and copy the output path
Then find the running shell using the command echo $SHELL
Open the shell file (mine is zsh - ~/.zshrc)
Add the below lines in your shell file
complete -C '<add_the_path_copied_from_first_step>' aws
Then use the source
command to update the file changes. For example: source ~/.zshrc
You need to have the aws_completer in your path for this to work correctly. Another option would be to modify the aws_zsh_completer.sh script.
complete -C aws_completer aws
complete -C <pathtoaws_completer>/aws_completer aws
complete
is relevant to zsh
as well, based on AWS CLI autocompletion docs, plus docs for other autocompletion tools