The AWS CLI
The CLI is an open-source tool built on the AWS SDK for Python (Boto) to perform setups, determine whether calls work as intended, verify status information, and more. The CLI provides another access tool for all AWS services, including S3. Unlike the Management Console, the CLI can be automated via scripts.
To authenticate your AWS account to the CLI, you must create a configuration file to obtain your public key and secret key. Next, you will install and then configure the AWS CLI.
Exercise 1.03: Configuring the CLI
In this exercise, we will configure the CLI with our AWS access key ID and AWS secret access key. Follow these steps to complete the exercise:
- First, go to the AWS Management Console and then IAM. You might have to log in to the account. Then, click Users:
- In the upper-right corner of the signed-in AWS Management Console, click My Security Credentials:
- Next, click Continue to Security Credentials:
- Click the Access keys (access key ID and secret access key) option:
- Then, click Create New Access Key:
- Click Download Key File to download the key file:
The rootkey.csv file that contains the keys will be downloaded. You can view the details by opening the file.
Note
Store the keys in a safe location. Protect your AWS account and never share, email, or store keys in a non-secure location. An AWS representative will never request your keys, so be vigilant when it comes to potential phishing scams.
- Open Command Prompt and type aws configure.
- You will be prompted for four input variables. Enter your information, then press Enter after each input:
AWS Access Key ID
AWS Secret Access Key
Default region
Default output format (json)
- The name is obtained in your console (Oregon is displayed here, but yours is determined by your unique location):
- The codes for regions are obtained from the following Available Regions list:
- The command Prompt's final input variable will look as follows. Then, press Enter:
You can change the configuration anytime by entering the aws configure command.
In this exercise, you configured the security credentials for your AWS account. We will use these credentials to access the AWS APIs in the rest of the book.