In this article we will look how we can enable command completion for AWS CLI.
Prerequisites
Install AWS CLI on the Ubuntu distribution.
$ aws --version
aws-cli/2.13.32 Python/3.11.6 Linux/6.2.0-1012-aws exe/x86_64.ubuntu.22 prompt/off
Check out my article on installing AWS CLI.
Configuration
Verify the path of aws_completer
in our system.
$ which aws_completer
/usr/local/bin/aws_completer
Verify the shell of our system.
$ echo $SHELL
/bin/bash
Add the location of aws_completer
in the PATH.
$ vi ~/.bash_profile
export PATH=/usr/local/bin/:$PATH
Enable the command completion by adding the below entry in .bashrc
file.
$ vim .bashrc
complete -C '/usr/local/bin/aws_completer' aws
Reload the profile to take the new changes.
$ source ~/.bash_profile
$ source ~/.bashrc
Verify the command completion.
$ aws dynamodb d<TAB>
delete-backup describe-contributor-insights describe-import describe-time-to-live
delete-item describe-endpoints describe-kinesis-streaming-destination disable-kinesis-streaming-destination
delete-table describe-export describe-limits
describe-backup describe-global-table describe-table
describe-continuous-backups describe-global-table-settings describe-table-replica-auto-scaling
Reference
https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html
Top comments (0)