Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 2

Performance Support

Architecting on Amazon Web Services: Installing AWS


Command Line Interface on Linux

Transcript
In this demonstration, I'll install the AWS command line interface in Linux.

In EC2, if you've launched an Amazon Linux instance using the Amazon-supplied AMI for Amazon
Linux, then you're already going to have the AWS command line interface installed within that
instance. When I connect to my Amazon Linux instance using SSH, I can type aws help to see if it will
display the help page. And the fact that it does tells me that the AWS CLI has already been installed
here. However, if I were to issue some other command such as ec2-describe-regions, because I
haven't specified an access key or a secret key, I'm limited in what I can do.

In other words, Amazon Web Services does not trust any commands that I issue. I have to link this
installation of the AWS CLI to my AWS account. Let's take a look at installing and configuring the AWS
command line interface in an on-premises Linux virtual machine. The online documentation provided
by Amazon Web Services explains what the purpose of the AWS command line interface is, along with
explanations of how to get set up with it. First that would involve installing the command line interface,
which can be done on Windows or Linux. I'll click on the link here for Linux, OS X, or UNIX. And here I
can see some prerequisites whereby we should make sure that we have Python installed.

And, as I scroll down further through, it talks about some various ways that I actually go through the
installation or I can download an installer that I can then have available locally. I can unzip it and then
work with it so I have the CLI running in Linux. I have also got an explanation here on how to
configure the AWS CLI. Installing it isn't enough. We need to configure it so that it knows our access
key related to our AWS account as well as our secret key. So, as we go further down, we can see there
are various ways that that can be done either in Windows or in Linux. So further down, I can see the
variations on how to do this using a non-Windows environment. I'm now working with a Red Hat
Enterprise Linux 7.1 virtual machine that I'm hosting on my own network. This is not running as an
instance in EC2.

Here I'm going to use the wget command along with the URL where I can download the EC2 API tools
for Linux. And I'll press Enter to begin the download process. If I type ls, we can now see that we've
got this file downloaded. The next thing to do would be to unzip that ZIP file and then place the files in
the appropriate location. I've already used the Linux unzip command. And I've placed the files that
were unzipped under opt, ec2, tools. And here I'm actually looking at the contents of the bin or binary
folder where I can see a lot of the binaries that are available here that make the AWS CLI function
properly on Linux.

Like at the command line, what I should be doing here also is verifying the versions of Java and Python
that we're using. We'll start with Python. I type python --version. I can see that we have Python
2.7.5 installed. So Python is there. If I type java -version, here it's reporting that we have Java
version 1.7075 installed. Now this is important because the AWS CLI for Linux requires Java 1.7 or
later. The next thing that we need to do is set some environment variables.

Here I've decided I'm going to put a lot of these environment variables in my startup file when I log in
as the root user. So I'm putting this in the .bashrc startup file. Here I've got a number of variables
such as the base location where I've installed my CLI tools, which is under /opt/ec2. I've also got the

© 2015 Skillsoft Ireland Limited


SKILLSOFT PERFORMANCE SUPPORT

EC2_HOME variable that points further into that – into the tools folder. Then I have specified my
specific AWS_ACCESS_KEY along with my AWS_SECRET_KEY. And finally, I'm specifying the EC2_URL,
which in this case specifies my region of us-west-2. And we also need to make a change to the path
variable in Linux so it includes the EC2 tools – specifically the bin folder, which is what we were looking
at over here on this screen.

Finally, I have to specify where Java is installed on this Linux installation – in this case the JAVA_HOME
variable. So, because these are in the .bashrc file, they will be executed when I log in as the user, in
this case, that owns the .bashrc file, which is root. Now we can verify that the installation is configured
properly in a number of ways. One is to use the ec2-describe-regions command. Actually, we could
use any valid command to make sure it's making an authenticated connection to our AWS account so
that we can work with AWS resources from the command line. And, if I press Enter on this command,
it should return back a number of regions.

Now you remember that when we tried to do this in the Amazon Linux instance running in the cloud,
we had not configured it with access keys. So therefore it didn't return any information. So, at this
point, I'm ready to get to work using the AWS CLI here in Linux. For example, I might also run the
ec2-describe-instances command to give me information about instances that we've got configured
in EC2.

In this video, we learned how to install the AWS command line interface in Linux.

© 2015 Skillsoft Ireland Limited

You might also like