Preparing the AWS Command Line for a Windows Environment
The method for installing and preparing AWS CLI varies from one operating system to another. Here's how to deploy it for Windows.
Just as Windows operating systems can be configured using PowerShell, Amazon Web Services (AWS) also has its own command line environment. This environment is called the AWS Command Line Environment, or, more commonly, AWS CLI.
AWS CLI allows you to interact with AWS from a command prompt, but, unlike PowerShell, it must be manually deployed.
The method used to install AWS CLI and to prepare it for use varies from one operating system to another. If you want to use the AWS CLI from a Windows operating system, go here and download and run the AWS CLI MSI Installer for Windows. This Web page also contains links to download AWS CLI for other platforms.
Like most other .MSI files, the AWS CLI MSI Installer uses a simple, wizard-based installation. Upon launching the .MSI file, you will be taken to the wizard's Welcome screen. Click Next, and you will see a screen asking you to accept the corresponding license agreement. After doing so, click Next.
At this point, you will see a screen asking you to choose the features that will be installed, as shown in Figure 1. Go ahead and accept the defaults, and click Next, followed by Install. The installation process only takes a few seconds to complete. When the process completes, click Finish.
The AWS CLI interface is now installed, but is not yet ready to use. If you have ever used PowerShell to connect to Microsoft Azure, then you know that the process requires you to manually authenticate PowerShell into the Azure environment. AWS CLI works in a similar way. In order to access your AWS environment, you must configure AWS CLI to authenticate into the AWS cloud.
In order to authenticate into the AWS cloud, you will need two pieces of information -- the access key ID and the secret access key. The access key ID works similarly to a user name, and the secret access key is somewhat like a password. Unlike a standard password, however, the authentication process makes use of PKI encryption.
The first thing that you will need to do in order to use AWS CLI is to generate the access key ID and the secret access key. To do so, log in to the AWS console (using your normal credentials). Now, go to the console home, and click on Security & Identity, followed by IAM, as shown in Figure 2.
Now, click on Users, and then click on your username. Depending on how you usually use AWS, it is possible that no user accounts will appear. If that happens, then click on the Create New User button, and follow the prompts to create a user account. The reason why you might need to do this is because the access keys are associated with an account.
Click on the account, and then click on the Manage Access Keys button. The resulting screen should display the access key ID. Make note of the access key ID, and then click on the Create Access Key button. When prompted, download the credential file.
Now, open an elevated Command Prompt window, and navigate to C:\Program Files\Amazon\AWSCLI. Next, type the following command:
AWS will now prompt you to enter four pieces of information. You will be asked for your access key ID and your secret access key. Both of these can be found in the .CSV file that you just downloaded. It's a good idea to copy and paste these values directly from the .CSV file, rather than trying to type them manually.
The next piece of information that you will have to provide is the region. I use US-East-1, but you should use the region that is appropriate for your geographic location. Finally, you will need to specify the default output format. Personally, I prefer text, but some people like using JSON.
You can see what the process looks like in Figure 3. I have intentionally left the inputs blank for security reasons, but you can use the screen capture to get a feel for the process.
AWS creates two files -- Config and Credentials. These files store the AWS CLI configuration and the credentials to be used. You should now be able to interact with AWS from the command line environment.
Brien Posey is a seven time Microsoft MVP with over two decades of IT experience. As a freelance writer, Posey has written many thousands of articles and written or contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and healthcare facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. When He isn't busy writing, Brien Posey enjoys exotic travel, scuba diving, and racing his Cigarette boat. You can visit his personal Web site at: www.brienposey.com.