The Applied AI and Natural Language Processing Workshop
上QQ阅读APP看书,第一时间看更新

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:

  1. First, go to the AWS Management Console and then IAM. You might have to log in to the account. Then, click Users:

    Figure 1.23: The Management Console home page with the Users option highlighted

  2. In the upper-right corner of the signed-in AWS Management Console, click My Security Credentials:

    Figure 1.24: My Security Credentials

  3. Next, click Continue to Security Credentials:

    Figure 1.25: Security Credentials

  4. Click the Access keys (access key ID and secret access key) option:

    Figure 1.26: Accessing key generation

  5. Then, click Create New Access Key:

    Figure 1.27: Creating a new access key

  6. Click Download Key File to download the key file:

    Figure 1.28: Downloading 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.

  7. Open Command Prompt and type aws configure.
  8. 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)

  9. The name is obtained in your console (Oregon is displayed here, but yours is determined by your unique location):

    Figure 1.29: Location search

  10. The codes for regions are obtained from the following Available Regions list:

    Figure 1.30: List of available regions

  11. The command Prompt's final input variable will look as follows. Then, press Enter:

Figure 1.31: The last step in the AWS CLI configuration in Command Prompt

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.