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.
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.
Next, we need to run the following command to verify where the AWS CLI auto-complete files are located using the line below.
The result are shown below, please copy the path.
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.
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