Installing the AWS CLI on OS X and Linux

Will Button
InstructorWill Button
Share this video with your friends

Social Share Links

Send Tweet
Published 8 years ago
Updated 5 years ago

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.

[00:00] 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.

[00:15] 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.

[00:28] 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.

[00:58] 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.

[01:21] 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.

[01:32] 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.

[01:54] Let's start with the access key and the secret access key, since those both come from the same location.

[02:01] 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.

[02:15] 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.

[02:32] 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.

[02:49] 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.

[03:14] 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.

[03:33] 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.

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

egghead
egghead
~ 4 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today