How to configure the AWS CLI on your Mac

Written by
Written on
Tutorial Category Quick Tips
Experience level Beginner

Introduction

The AWS CLI is a command line interface which acts as a gateway to many AWS components. It can sometimes be a little confusing to get this handy tool working on your macOS computer, so here’s a really quick run-through on how to get it going.



Requirements:

  • A macOS computer
  • Python

Install using Pip

Pop open your terminal (you can hit Command + Space, and type terminal to get to it quickly), then enter the following:

$ pip install awscli --upgrade --user

There should be some activity while this is downloaded. Once this is done, head on to the next step.

Add the CLI tool to your PATH

This part can sometimes be a little confusing for newbies to the command line. The PATH is what is known as an environment variable, and it essentially tells your terminal where to look for executable programs, such as the AWS CLI. For your terminal to be able to find the tool, you’ll need to add it to your PATH like so:

$ pico ~/.bashrc

This will open a text editor full of code. Scroll all the way to the bottom by pressing Ctrl + V. Once you’re there, paste the following line:

export PATH=~/.local/bin:$PATH

What this is basically doing is saying to your terminal, I want to add the ~/.local/bin directory (which contains Pip executables) to any existing PATH that has been set.
Once you’re done, the final step is to load the new configuration into your current terminal session:

$ source ~/.bashrc

You should now be able to use the AWS CLI. You can check this by running this final command:

$ aws --version

You should see something like this:

aws-cli/1.15.76 Python/2.7.10 Darwin/17.5.0 botocore/1.10.75

You’re all set! Enjoy!


%d bloggers like this: