In this course, we will examine various options for operating programmatically with AWS, including Application Programming Interfaces, or APIs; Software Development Kits, or SDKs; and the AWS Command Line Interface, or CLI.
- A high-level introduction to AWS APIs and SDKs; the AWS CLI; and the concept of infrastructure as code
- System administrators
- Anyone else who is looking to learn different ways to automate or scale their interactions with AWS
- You should have a basic understanding of AWS and its services
- You should also have some exposure to interacting with a command-line shell or terminal using an operating system such as Windows, Linux, or macOS
Hello, and welcome to this lecture, where I will demonstrate how to install and configure the AWS command-line interface, or CLI, on a Windows machine.
So I’m here on a Windows machine without the AWS CLI currently installed. And to download the CLI, I can go to this page, which you can also find by just searching for “AWS CLI download.” And you see here on the right side we have links to download the CLI installers for Windows, macOS, or Linux. So I’m going to choose the link to download the Windows installer here, and when that finishes downloading, I can run this file, and the CLI setup wizard will launch. So I’ll click Next, and then I’ll accept the terms of the license agreement and click Next, then I’ll accept the defaults here and click Next, and finally, I’ll click Install. And when that’s done, I’ll click Finish.
So once the CLI is installed, it adds a command called aws to the system path, which I can then run from a command prompt along with various arguments corresponding to different AWS services, such as s3 or ec2. But before I can run any of these commands, I need to perform a one-time action to configure the credentials and default preferences I’d like to use with the CLI. And to do that, I’m going to type aws configure. And first, it’s going to ask me for an AWS Access Key ID. And so I’m going to use an access key ID from an IAM user who has already been assigned programmatic access credentials. And don’t worry, by the time you see this video I’ll have long since deleted these credentials, so they won’t be valid.
So I’ll paste the access key ID here, and then the secret access key. And now it’s asking me for a default region. So you can add a --region parameter to your CLI commands to specify the exact region where you want to execute that command. But if you don’t supply this parameter, the region you specify here as your default will be used instead. So I’ll enter us-east-1. And finally, it’s going to ask me for a default output format. And your choice here will depend on whether you’d prefer to see output in some sort of more friendly human-readable text format. So my options are json, yaml, yaml-stream, text, or table. But for the purposes of this demo, I’ll choose text.
And now that I’ve completed this initial configuration, I can begin to enter CLI commands, and these commands will execute using the credentials I just specified. So to interact with S3, I can run the command aws s3, and to list the buckets in my account I can type ls. And here you see I have 2 demo buckets. But let’s say I want to add a third. So now I can enter the command aws s3, then mb, for make bucket, and the name of my new bucket will be s3://cloudacademydemobucket3. And since my IAM user has permission to create an S3 bucket, this command will succeed. So if I run aws s3 ls again, we see my newly created bucket now appears in this list. So you see how I was able to create an S3 bucket by just running that one simple command. Now imagine if I needed to create 30 or 40 more buckets. It’s obviously much simpler and less tedious to leverage something like the AWS CLI to automate this process rather than having to repeatedly walk through the various screens in the console.
So that’s how to install and configure the AWS CLI, and I barely scratched the surface of what it’s possible to do here. But hopefully, now you’ve seen just how easy it is to interact with services like S3 from the command line using the AWS CLI.
Danny has over 20 years of IT experience as a software developer, cloud engineer, and technical trainer. After attending a conference on cloud computing in 2009, he knew he wanted to build his career around what was still a very new, emerging technology at the time — and share this transformational knowledge with others. He has spoken to IT professional audiences at local, regional, and national user groups and conferences. He has delivered in-person classroom and virtual training, interactive webinars, and authored video training courses covering many different technologies, including Amazon Web Services. He currently has six active AWS certifications, including certifications at the Professional and Specialty level.