DEV Community

Cover image for AWS CLI - Command Completion
Unni P
Unni P

Posted on • Originally published at iamunnip.hashnode.dev

AWS CLI - Command Completion

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Verify the shell of our system.

$ echo $SHELL
/bin/bash
Enter fullscreen mode Exit fullscreen mode

Add the location of aws_completer in the PATH.

$ vi ~/.bash_profile
    export PATH=/usr/local/bin/:$PATH
Enter fullscreen mode Exit fullscreen mode

Enable the command completion by adding the below entry in .bashrc file.

$ vim .bashrc
    complete -C '/usr/local/bin/aws_completer' aws
Enter fullscreen mode Exit fullscreen mode

Reload the profile to take the new changes.

$ source ~/.bash_profile

$ source ~/.bashrc
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Reference

https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html

Top comments (0)