What is the AWS CLI? |
The AWS Command Line Interface (CLI) is for managing your AWS services from a terminal session on your own client, allowing you to control and configure multiple AWS services and implement a level of automation.
If you’ve been using AWS for some time and feel comfortable clicking your way through all the services, you may have noticed that there’s more to AWS than the default eye-catching browser console. Using the AWS CLI can help you to unlock further potential when managing your AWS environment. The AWS CLI is a unified tool to manage your AWS services from a terminal session on your own client. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.
In this blog, I will show you how to use the AWS CLI and how to install it on your Windows, Linux, Mac, or Unix Operating System. To see the process to configure the AWS CLI in action, check out our beginner Introduction to the AWS CLI Hands-on Lab. During this Lab, you’ll learn how to configure the AWS CLI, leverage the built-in help tool, and set up an S3 website using the AWS CLI. The more you use the AWS CLI, the more you’ll see how powerful it is.
Downloading and installing the AWS CLI
First, you need to download the AWS CLI. Depending on your operating system, it will require a different method.
Linux / macOS / Unix
You must ensure that you have at least Python 2 version 2.6.5+ or Python 3 version 3.3+ installed. To verify your current version, run the command:
The recommendation for installing the AWS CLI is to use the bundled installer provided by AWS. The bundled installer includes all dependencies required for the installation.
1. To begin the installation run the following command:
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
2. Next, you must unzip the downloaded package from step 1:
3. Once the package in unzipped, you can run the installation:
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Using the -b option allows all users to use the AWS CLI from any directory, meaning you will not need to specify the install directory in the user’s $PATH variable.
You must be running Microsoft Windows XP or later.
There are three MSI installers to choose from:
- 64-bit version
- 32-bit version
- A CLI Setup file that will automatically detect what you are running and install the appropriate version (64-bit or 32-bit)
1. Select the option required to download the MSI
2. Run the downloaded MSI installer or the CLI setup file, as required
3. Follow the instructions that appear
Once installed, the program files will be stored as shown:
C:\Program Files (x86)\Amazon\AWSCLI
To confirm the installation, use the aws –version command at a command prompt.
Simple configuration of the AWS CLI
Once you have installed the AWS CLI, you now need to configure the application to be able to connect to your AWS account. To do so, enter the following from your command prompt:
Through aws configure, the AWS CLI will prompt you for four pieces of information. The first two are required. These are your AWS access key ID and AWS secret access key, which serve as your account credentials. You can generate new credentials within AWS Identity and Access Management (IAM) if you do not already have them. The other information you will need is region and output format, which you can leave as default for the time being.
aws configure AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY Default region name [None]: us-west-2 Default output format [None]: json
The default region name simply defines the Region where you requests will be sent to. For all available regions, please see the following: Regions and Endpoints.
The default output format specifies how the results are formatted. Values that can be used here include:
The AWS access key ID and AWS secret access key are used to authenticate your AWS account. This authorizes you to carry out specific tasks and functions as defined by your permissions level.
The AWS access key ID is made up of 20 random uppercase alphanumeric characters, such as the one displayed on screen.
The AWS secret access key is made up of 40 random upper and lowercase alphanumeric and non-alphanumeric characters as displayed.
These access keys can be created for any IAM user who requires authentication from a programmatic perspective, such as when using the AWS CLI.
IMPORTANT: When the access keys are created, you are prompted to download and save the details. The secret access key ID will only be displayed once, and if you lose it, then you’ll have to delete the associated access key ID and recreate new keys for the user.
It’s worth noting that it’s not possible to retrieve lost secret access key IDs as AWS does not retain copies of these for security reasons in case they were compromised. By associating the access keys with the AWS CLI, it ensures that all API requests made to AWS are signed with a digital signature.
You can use the IAM service for creating new access keys for your users. To dive deeper into this service and other authentication and access control mechanisms, go to AWS: Overview of AWS Identity & Access Management (IAM) and Understanding of AWS Authentication, Authorization & Accounting.
With the AWS CLI now installed and configured on your client, you can take the next steps to configuring, managing, and scripting AWS services.
For more commands relating to the AWS CLI, take a look at the official AWS CLI documentation.
Top 13 Amazon Virtual Private Cloud (VPC) Best Practices
Amazon Virtual Private Cloud (VPC) brings a host of advantages to the table, including static private IP addresses, Elastic Network Interfaces, secure bastion host setup, DHCP options, Advanced Network Access Control, predictable internal IP ranges, VPN connectivity, movement of interna...
Big Changes to the AWS Certification Exams
With AWS re:Invent 2019 just around the corner, we can expect some early announcements to trickle through with upcoming features and services. However, AWS has just announced some big changes to their certification exams. So what’s changing and what’s new? There is a brand NEW ...
New on Cloud Academy: ITIL® 4, Microsoft 365 Tenant, Jenkins, TOGAF® 9.1, and more
At Cloud Academy, we're always striving to make improvements to our training platform. Based on your feedback, we released some new features to help make it easier for you to continue studying. These new features allow you to: Remove content from “Continue Studying” section Disc...
AWS Security Groups: Instance Level Security
Instance security requires that you fully understand AWS security groups, along with patching responsibility, key pairs, and various tenancy options. As a precursor to this post, you should have a thorough understanding of the AWS Shared Responsibility Model before moving onto discussi...
Cloud Migration Risks & Benefits
If you’re like most businesses, you already have at least one workload running in the cloud. However, that doesn’t mean that cloud migration is right for everyone. While cloud environments are generally scalable, reliable, and highly available, those won’t be the only considerations dri...
Real-Time Application Monitoring with Amazon Kinesis
Amazon Kinesis is a real-time data streaming service that makes it easy to collect, process, and analyze data so you can get quick insights and react as fast as possible to new information. With Amazon Kinesis you can ingest real-time data such as application logs, website clickstre...
Google Cloud Functions vs. AWS Lambda: The Fight for Serverless Cloud Domination
Serverless computing: What is it and why is it important? A quick background The general concept of serverless computing was introduced to the market by Amazon Web Services (AWS) around 2014 with the release of AWS Lambda. As we know, cloud computing has made it possible for users to ...
Google Vision vs. Amazon Rekognition: A Vendor-Neutral Comparison
Google Cloud Vision and Amazon Rekognition offer a broad spectrum of solutions, some of which are comparable in terms of functional details, quality, performance, and costs. This post is a fact-based comparative analysis on Google Vision vs. Amazon Rekognition and will focus on the tech...
New on Cloud Academy: CISSP, AWS, Azure, & DevOps Labs, Python for Beginners, and more…
As Hurricane Dorian intensifies, it looks like Floridians across the entire state might have to hunker down for another big one. If you've gone through a hurricane, you know that preparing for one is no joke. You'll need a survival kit with plenty of water, flashlights, batteries, and n...
Amazon Route 53: Why You Should Consider DNS Migration
What Amazon Route 53 brings to the DNS table Amazon Route 53 is a highly available and scalable Domain Name System (DNS) service offered by AWS. It is named by the TCP or UDP port 53, which is where DNS server requests are addressed. Like any DNS service, Route 53 handles domain regist...
How to Unlock Complimentary Access to Cloud Academy
Are you looking to get trained or certified on AWS, Azure, Google Cloud Platform, DevOps, Cloud Security, Python, Java, or another technical skill? Then you'll want to mark your calendars for August 23, 2019. Starting Friday at 12:00 a.m. PDT (3:00 a.m. EDT), Cloud Academy is offering c...
What Exactly Is a Cloud Architect and How Do You Become One?
One of the buzzwords surrounding the cloud that I'm sure you've heard is "Cloud Architect." In this article, I will outline my understanding of what a cloud architect does and I'll analyze the skills and certifications necessary to become one. I will also list some of the types of jobs ...