Introduction to the AWS Command Line Interface
Using the AWS Command Line Interface
Although most AWS services can be managed through the console in Amazon's browser interface or via the APIs commonly used for programmatic access, there is a third way that, in many cases, can be very useful: the Command Line Interface (CLI). AWS has made software packages available for Linux, MacOS, and Windows that allows you to manage the main AWS services from a local terminal session's command line.
In this course, the Cloud Expert and Linux System Administrator David Clinton will tell you everything you need to know to get started with the AWS Command Line Interface and to use it proficiently in your daily operations. He will also provide many examples to clearly explain how command line connectivity really works.
Who should take this course
This is an intermediate course, as such you should already know the basic AWS concepts, and in particular of the services that described in this tutorial. Also, some experience with the Linux Command Line Interface is not strictly speaking necessary, but still quite useful.
If you want to boost your knowledge of AWS, EC2, S3, and RDS, we strongly suggest you take our other AWS courses. Also, self-test questions are available if you'd like to test and increase your knowledge.
If you have thoughts or suggestions for this course, please contact Cloud Academy at email@example.com.
Hi and welcome to cloudacademy.com's video series on AWSCLI, which stands for Amazon Web Services Command Line Interface. In this video, we're going to learn how to install and configure the AWSCLI. The AWSCLI, by the way, is a package that, when installed and configured, will allow you to interact with your Amazon Instances and account directly from a command line terminal on your own computer. First thing, make sure that you have a recent enough version of Python. We're at 2.7.6 and the AWSCLI requires 2.6.3 or later, which if my mathematics is good enough, that should be sufficient. Next, make sure that you've got some basic software to handle the installation. Unzip and W Get are two packages you will need, but I had them on this machine already so that's not necessary. Next I'll just make a directory, AWS, just to store the downloaded package, and I'm going to CD, change directory into AWS. Nothing there yet. We hit LS to just list the contents of the directory and there is nothing yet.
Then we're going to use W Get, which is simply a command to get some package using a URL from the Internet. You're going to cut and paste because it's something of a longer command. So where W Get means get the following package on the S3 amazonaws.com site in the AWS-CLI directory. And the package is called awscli-bundle.zip. That's done. Now let's unzip the package. I used the tab key to complete the command. Command complete is a great tool that's available on Unix Linux based machines that will anticipate what your likely trying to do when you start a command and, if possible, finish it. I mention this now because we will later have to configure tab complete for the AWSCLI. Meantime, let's hit enter and the package is now unzipped. Now we're going to have to install the package. Let me explain what this command will do.
Pseudo, because we are going to access resources on the machine that require administrative permission. We're going to install this package to the user local AWS directory and then create a symlink and user local being AWS just so we can access AWS from anywhere on the system without necessarily having to use an absolute address. That's done. Let's just make sure that it's actually working. AWS help worked, so AWS is properly installed.
Since we mentioned help, I might as well add some more details about the ALS, AWS help that's available. Let's say you type AWS and EC2, which is a service on Amazon that AWSCLI can access and then the word help. You'll be shown an extensive selection of parameters and options that the AWS EX2 command can access. This obviously is true of all AWS services. Now we can configure the package. First, you'll have to go to the AWS console, that is on the Amazon website. Click on your account name at the top right of the screen. Select security credentials and then access keys. You can create a new access key set if necessary. You should note both the access key ID and secret access key, because they're going to be necessary in just a minute. Now there are a number of ways that you can configure AWSCLI. We're going to demonstrate just AWS configure. And we'll briefly mention the others later. First, AWS asks for the access key ID, I'll paste that in. Then the secret access key, I'll paste that in.
Then the region . . .the default, I'll make US East-1. Probably should be East-1. The default output format, I'll make text.
Obviously there are other options. That's it, we're configured. You could also configure your credentials and you preferences, you default preferences in the file credentials that's in the .aws folder, .aws means it's a hidden folder.
So if you were in your home folder, you could go cd.aws, and there is a config file, and there would be a credentials file if you had actually created it yet.
You can make such a credentials file and populate it with the information you need. You could also set the credentials and the configuration by using export, export the access key, export the secret access key.
The documentation for that is available on the Amazon website. Finally, we're going to set up command completion. As I mentioned before, tab works to have the system anticipate what you're trying to do. But it won't do that by default in AWS unless we use this Complete-C. And it will use the AWS completer which is located in user local AWS bin. That's seems to be done. We are now completely installed and configured.
About the Author
David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.
Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.
Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.
His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.