Contents
How to Use the AWS Command Line Interface
This course introduces you to the AWS Command Line Interface.
Learning Objectives
- Install and configure the AWS Command Line Interface
- Manage CLI credential profiles
- Structure CLI commands
- Better control the outputted response data
- Use input functionality to make working with the CLI easier
Intended Audience
- Those looking to get more familiar with the AWS Command Line Interface
Prerequisites
- Have a good understanding of command line basics
- Understand some of the fundamental AWS services, such as Amazon EC2, Amazon DynamoDB, Amazon S3, and IAM
- Familiarity with JSON and YAML will help to better understand some of the practical parts of the course.
- For more information on some of these services, check out the following courseware titled:
In this lecture, I’ll be installing the latest version of the AWS CLI, which currently is AWS CLI v2. I’ll be installing the CLI on a Mac, so keep that in mind if you’re following along, as the syntax for Windows and Linux machines is different. But have no fear, you can always consult the AWS documentation for the appropriate commands for your operating system.
Here I am in my terminal, and the first command I’m going to run is aws –version. This checks which version of the AWS CLI I currently have. As you can see, it cannot find the aws command, which means it’s not currently installed.
To install the latest version of the CLI, I’m going to use the commands from the Mac section of the documentation. Here you can see there are two major commands you have to run: a download command and an install command.
For Mac, the first command you’ll need to run will use the curl command to download the file from this address. Then, using the -o option, it names the file AWSCLIV2. Let’s run this command in the terminal.
After it installs successfully, I’ll go back to the documentation and use the second command. This will run the installation using the Mac standard installer program. It uses the -pkg parameter to specify which package to install. And then the -target parameter to specify where I want to install it.
Let’s run this in the terminal. I’ll input my password here.
It looks like the command successfully ran, so let’s double-check to make sure the AWS CLI is installed properly. To do this, I’ll run aws –version once again. And it looks like the version is installed and up to date so I’m good to go!
If you’re having issues with the installation - for example, if the aws keyword returns a command not found error, you may want to double-check to see if you’re following the correct instructions for your operating system. Remember that these commands will be different for both Linux and Windows, so be sure to check the documentation.
That’s all for this one - see you soon!
Alana Layton is an experienced technical trainer, technical content developer, and cloud engineer living out of Seattle, Washington. Her career has included teaching about AWS all over the world, creating AWS content that is fun, and working in consulting. She currently holds six AWS certifications. Outside of Cloud Academy, you can find her testing her knowledge in bar trivia, reading, or training for a marathon.