Quick Tip: AWS CLI Command Autocompletion
The AWS CLI is extremely powerful and can enable access to AWS services and data for scripting and other purposes. Personally, remembering the breadth of commands available is a challenge, but I learned today that autocomplete is available.
The following describes how to setup autocompletion for a system using bash and installed via pip, yum, or Homebrew.
Locate the auto completer package:
$ which aws_completer
Enable command autocompletion (assumes default path to aws_completer):
$ complete -C '/usr/local/bin/aws_completer' aws
Test command completion:
$ aws eTAB
ec2 efs elastictranscoder es
ecr elasticache elb events
ecs elasticbeanstalk emr
To enable auto completion in the future, add it to the bash user’s profile (assuming default path):
$ cat >> ~/.bash_profile
complete -C '/usr/local/bin/aws_completer' aws
Further detail can be found in AWS Documentation, including details on other types of shells and where else you may find the aws_completer package.