Configure AWS CLI Autocomplete

In the last blog post on the topic of AWS CLI, we went over the installation process of AWS CLI on Ubuntu 20.04, and today, we will learn how to configure autocomplete for AWS CLI commands.

By default, AWS CLI doesn’t configure itself with command completion, which can be challenging when trying to figure out commands with many switches and arguments.

Get Started

To get started and following out the previous post, we need to note the installation location of our AWS CLI. The default installation location is as follow.

/usr/local/bin/aws

Next, we need to run the following command to verify where the AWS CLI auto-complete files are located using the line below.

which aws_completer

The result are shown below, please copy the path.

/usr/local/bin/aws_completer

Add AWS_Completer Path to Bash

Now that we have the path, we need to open our Bash profile and in our case (if you run Ubuntu) it is .bashrc

Go ahead and open the .bashrc file and add the following line.

export PATH=/usr/local/bin/aws_completer:$PATH

Run the following two commands, the first one will add the autocomplete and the second one will reload the terminal.

complete -C '/usr/local/bin/aws_completer' aws
source ~/.bashrc
Published
Categorized as AWS

Leave a comment

Your email address will not be published. Required fields are marked *