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.
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.
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:
# python --version
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:
# unzip awscli-bundle.zip
3. Once the package in unzipped, you can run the installation:
# ./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.
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:
# aws configure
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 a region and output format, which you can leave as default for the time being.