Enter Your Email Address to Watch This Lesson

Your link to unlock this lesson will be sent to this email address.

Unlock this lesson and all 985 of the free egghead.io lessons, plus get Tools content delivered directly to your inbox!



Existing egghead members will not see this. Sign in.

Installing the AWS CLI on OS X and Linux

4:00 Tools lesson by

Installing the AWS CLI on your local workstation may be one of the biggest boosts to productivity you can make if you use AWS often. Almost all AWS features are available via the CLI allowing you to script, schedule and automate many AWS related tasks.
In this lesson, I’ll show you how to setup and verify the AWS CLI.

Get the Code Now
click to level up

egghead.io comment guidelines

Avatar
egghead.io

Installing the AWS CLI on your local workstation may be one of the biggest boosts to productivity you can make if you use AWS often. Almost all AWS features are available via the CLI allowing you to script, schedule and automate many AWS related tasks.
In this lesson, I’ll show you how to setup and verify the AWS CLI.

I recommend using installation with the bundled installer. There are other ways to install it that give you more fine-grained control over your version of Python and other options, but for the first-time user, just go with the bundled installer, and you'll be up and running.

The only thing you need to do prior is make sure that you have a valid version of Python. You can do that with python --version, and you want to make sure that you have version 2.6.5 or greater.

Now, I'm going to download the bundled installer using cURL, and I'll do that with cURL https://s3.amazonaws.com/aws-cli/awscli-bundle.zip. I'll save that with a -O flag as awscli-bundle.zip. Can unzip that, and if I look in that directory, there's a folder now called awscli-bundle.

To install it, I'm going to type sudo.\awscli-bundle install, provide a -I flag for install location, and I want it to go to user\local\AWS -B user\local\bin\AWS. That just tells it where to put the binary and where to put the symlink. Provide my sudo creds.

Now, if I type AWS --version, you can see that it is installed successfully. Now, the AWS CLI is installed, and we need to configure it to work with my AWS account.

Configuration's accomplished by typing AWS and then providing the configure option. That's going to ask me for four different pieces of information. It's going to ask me for the AWS access key ID, a secret access key, a default region name, and default output format. Let me show you where to get all of that information from.

Let's start with the access key and the secret access key, since those both come from the same location.

In your AWS management console, you're going to select your username, go to security credentials. If you see this screen, it means you're still using the root credentials for your AWS access instead of an IAM user account with restricted access.

Assuming that you're OK with that, you're going to click continue to security credentials and then expand the access key's dropdown menu. If you are using IAM users, you can select a users menu, choose your user account, and then click create access key.

No matter which route you go to, you're going to end up on this screen with your security credentials. You'll click the link that says show security credentials. The important thing to note here is this is the one and only time you will ever get access to this secret access key, so you might want to write it down somewhere.

I'm going to copy this value. Return to my AWS configure screen, paste that value in. It's going to prompt for the secret access key, so I'm going to copy that value, paste that in. Now it's asking me for a default region name. To get that piece of information, I'm going to go to my EC2 tab, and you can see my running instances are in Oregon.

If you take a look at the URL, you can see that's US-West-2, so I'm going to enter US-West-2 here. If my instances were in Northern California, that would be US-West-1, or if they were in North Virginia, that would be US-East-1.

The default output format, I have three choices here. I can choose text, JSON, or table. I'm going to choose JSON, because that gives me the ability, when I run the commands, to pipe the output to jq, which has some really nice formatting features.

It's all set. Let's test that it works by using ASWS EC2 describe-instances, and there's all of my instances.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?