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.
New Content: Get Ready for the CISM Cert Exam & Learn About Alibaba, Plus All the AWS, GCP, and Azure Courses You Know You Can Count On
This month our team of intrepid certification specialists released five learning paths, seven courses, 19 hands-on labs, and three lab challenges! One particularly interesting new learning path is Certified Information Security Manager (CISM) Foundations. After completing this learn...
Which Certifications Should I Get?
The old AWS slogan, “Cloud is the new normal” is indeed a reality today. Really, cloud has been the new normal for a while now and getting credentials has become an increasingly effective way to quickly showcase your abilities to recruiters and companies. With all that in mind, the s...
The 12 AWS Certifications: Which is Right for You and Your Team?
As companies increasingly shift workloads to the public cloud, cloud computing has moved from a nice-to-have to a core competency in the enterprise. This shift requires a new set of skills to design, deploy, and manage applications in cloud computing. As the market leader and most ma...
AWS Certified Solutions Architect Associate: A Study Guide
Want to take a really impactful step in your technical career? Explore the AWS Solutions Architect Associate certificate. Its new version (SAA-C02) was released on March 23, 2020. The AWS Solutions Architect - Associate Certification (or Sol Arch Associate for short) offers some ...
New Content: AWS Terraform, Java Programming Lab Challenges, Azure DP-900 & DP-300 Certification Exam Prep, Plus Plenty More Amazon, Google, Microsoft, and Big Data Courses
This month our Content Team continues building the catalog of courses for everyone learning about AWS, GCP, and Microsoft Azure. In addition, this month’s updates include several Java programming lab challenges and a couple of courses on big data. In total, we released five new learning...
Where Should You Be Focusing Your AWS Security Efforts?
Another day, another re:Invent session! This time I listened to Stephen Schmidt’s session, “AWS Security: Where we've been, where we're going.” Amongst covering the highlights of AWS security during 2020, a number of newly added AWS features/services were discussed, including: AWS Audit...
AWS re:Invent: 2020 Keynote Top Highlights and More
We’ve gotten through the first five days of the special all-virtual 2020 edition of AWS re:Invent. It’s always a really exciting time for practitioners in the field to see what features and services AWS has cooked up for the year ahead. This year’s conference is a marathon and not a...
WARNING: Great Cloud Content Ahead
At Cloud Academy, content is at the heart of what we do. We work with the world’s leading cloud and operations teams to develop video courses and learning paths that accelerate teams and drive digital transformation. First and foremost, we listen to our customers’ needs and we stay ahea...
Excelling in AWS, Azure, and Beyond – How Danut Prisacaru Prepares for the Future
Meet Danut Prisacaru. Danut has been a Software Architect for the past 10 years and has been involved in Software Engineering for 30 years. He’s passionate about software and learning, and jokes that coding is basically the only thing he can do well (!). We think his enthusiasm shines t...
New Content: AWS Data Analytics – Specialty Certification, Azure AI-900 Certification, Plus New Learning Paths, Courses, Labs, and More
This month our Content Team released two big certification Learning Paths: the AWS Certified Data Analytics - Speciality, and the Azure AI Fundamentals AI-900. In total, we released four new Learning Paths, 16 courses, 24 assessments, and 11 labs. New content on Cloud Academy At any ...
New Content: Azure DP-100 Certification, Alibaba Cloud Certified Associate Prep, 13 Security Labs, and Much More
This past month our Content Team served up a heaping spoonful of new and updated content. Not only did our experts release the brand new Azure DP-100 Certification Learning Path, but they also created 18 new hands-on labs — and so much more! New content on Cloud Academy At any time, y...
AWS Certification Practice Exam: What to Expect from Test Questions
If you’re building applications on the AWS cloud or looking to get started in cloud computing, certification is a way to build deep knowledge in key services unique to the AWS platform. AWS currently offers 12 certifications that cover major cloud roles including Solutions Architect, De...