AWS CLI command completion in BASH

Sometimes you just have to do something simple in AWS — launch an EC2 instance, create a S3 bucket, run a lambda expression, insert some data into DynamoDB, etc.

You could do this via the AWS Management console — but that means logging in and using the Amazon Web Services very user-unfriendly user interface.

You could write a script that uses the Amazon SDK API via a library like Python Boto3.

Or you can install the AWS CLI and run a simple shell script.

But Amazon’s API is far from clear. And while the CLI is easier for simple tasks than Boto, for example, it still means you need to know just the right command sequence and arguments to get it right .

For example:

aws s3api create-bucket --region us-west-2 --acl public-read --bucket mybucket

It can be tricky to figure out the right flags (the above example is not right).

One nice thing to have is command line completion, and with the AWS CLI, in addtional to the aws command, it install aws_completer. In order to use the aws completer in your BASH shell prompt, you want to add the following to your .bashrc or .bash_profile file:

# Add aws command completion to .bashrc file

complete -C '/usr/local/bin/aws_completer' aws

Thanks to the following post for showing me how to do this:

View at

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s