Appendix C
Installing and Configuring the AWS CLI

This appendix includes instructions for installing and configuring the AWS CLI on Max OS X and Windows.

The AWS Command Line Interface (CLI) is a tool that lets you manage your AWS services using a command-line interface, over the internet. In this appendix you will learn to download, install, and configure the appropriate version of the AWS CLI on your computer.

Mac OS Users

If you are a Mac OS user, you can use a bundled installer to install the AWS CLI on your computer. The bundled installer requires Python2 version 2.6.5+ or Python3 version 3.3+ to be pre-installed on the computer.

To check the Python version on a Mac OS computer, open a Terminal window, type the following command, and hit Enter:

python --version

If you do not have a suitable version of Python installed on your computer, follow the instructions available at the following URL to get/update Python on your computer:

http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-python

Installing the AWS CLI

Type the following commands in a Mac OS Terminal window, or at the equivalent shell prompt on your system:

$ curl " https://s3.amazonaws.com/aws-cli/awscli-bundle.zip " -o "awscli-bundle.zip"

$ unzip awscli-bundle.zip

$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

If you do not have unzip installed, or do not have administrative privileges on your computer, you can use one of the techniques listed at the following URL to install the AWS CLI on your computer:

http://docs.aws.amazon.com/cli/latest/userguide/installing.html

Once you have installed the AWS CLI on your computer, type the following line to test the installation:

$ aws help

Your screen should display a list of aws commands along with a brief description of each (see Figure C.1).

Screenshot of the screen that display a list of AWS commands along with a brief description of each.

FIGURE C.1 List of AWS CLI commands, Mac OS

Typing the aws instruction takes you into the AWS CLI shell. To exit the AWS CLI shell and come back to your operating system's default shell, press q on your keyboard.

Configuring the AWS CLI

Before you can use the AWS CLI, to you need to configure the CLI tool on your computer. Type the following command in a Terminal window on your Mac, or appropriate shell prompt on your computer:

$ aws configure

You will be asked to provide the Access Key ID and Secret Access Key for an IAM user that has adequate permissions to access your resources. You will also be asked to provide a default AWS region and output options:

Abhisheks-MacBook:~ abhishekmishra$ aws configure
AWS Access Key ID [****************COFA]: 
AWS Secret Access Key [****************PcqG]: 
Default region name [eu-west-1]: 
Default output format [None]: 
Abhisheks-MacBook:~ abhishekmishra$ 

The Access Key ID and Secret Access Key were created for you when you created the IAM user, and you were prompted to record the information and save it in a safe place. If you do not remember your Access Key ID/Secret Access Key, you can use the IAM management console to generate a new set.

The region name is a string that identifies an AWS region. Table C.1 lists the values that you can type and the corresponding regions they represent.

TABLE C.1: AWS Region Names

REGION NAME AWS CLI STRING
US East (N. Virginia) us-east-1
US East (Ohio) us-east-2
US West (N. California) us-west-1
US West (Oregon) us-west-2
Canada (Central) ca-central-1
Asia Pacific (Mumbai) ap-south-1
Asia Pacific (Singapore) ap-southeast-1
Asia Pacific (Sydney) ap-southeast-2
Asia Pacific (Tokyo) ap-northeast-1
Asia Pacific (Seoul) ap-northeast-2
Asia Pacific (Osaka) ap-northeast-3
EU (Frankfurt) eu-central-1
EU (Ireland) eu-west-1
EU (London) eu-west-2
EU (Paris) eu-west-3
China (Beijing) cn-north-1
China (Ningxia) cn-northwest-1
South America (São Paulo) sa-east-1

The output option can be either JSON (default), or text.

You have now successfully installed and configured the AWS CLI tools on your Mac.

Windows Users

For Windows users, Amazon provides an installer package that can be used to install the CLI on a computer running Windows XP or a newer operating system. The AWS CLI is not supported on computers running older versions of Windows.

Installing the AWS CLI

Use the following link to download a Windows installer for your computer. Both 32-bit and 64-bit installers are available:

https://docs.aws.amazon.com/cli/latest/userguide/install-windows.html

Launch the installer and follow the on-screen instructions to complete the installation. By default, the AWS CLI will be installed at C:Program FilesAmazonAWSCLI (64-bit) or C:Program Files (x86)AmazonAWSCLI (32-bit).

To test the installation of the CLI, launch the command prompt, type the following command at the prompt, and press Enter:

> aws help

Your screen should display a list of aws commands along with a brief description of each (see Figure C.2).

Screenshot of the screen that display a list of AWS CLI commands along with a brief description of each.

FIGURE C.2 List of AWS CLI commands, Windows

Type q to go back to the command prompt.

Configuring the AWS CLI

Before you can use the AWS CLI, you need to configure the CLI tool on your computer with access keys for an IAM user account. Type the following command at the command prompt:

> aws configure

You will be asked to provide the Access Key ID and Secret Access Key for an IAM user that has adequate permissions to access an EC2 instance. You will also be asked to provide a default AWS region and output options:

Microsoft Windows [Version 10.0.16299.785]
(c) 2017 Microsoft Corporation. All rights reserved.
 
C:Usersmishr>aws configure
AWS Access Key ID [None]: AKIAIR2R5O3F4VHVCOFA
AWS Secret Access Key [None]: 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
Default region name [None]:
 
Default output format [None]:
C:Usersmishr>

The Access Key ID and Secret Access Key were created for you when you created the IAM user, and you were prompted to record the information and save it in a safe place. If you do not remember your Access Key ID/Secret Access Key, you can use the IAM management console to generate a new set.

The region name is a string that identifies an AWS region. Table C.2 lists the values that you can type and the corresponding regions they represent.

TABLE C.2 AWS Region Names

REGION NAME AWS CLI STRING
US East (N. Virginia) us-east-1
US East (Ohio) us-east-2
US West (N. California) us-west-1
US West (Oregon) us-west-2
Canada (Central) ca-central-1
Asia Pacific (Mumbai) ap-south-1
Asia Pacific (Singapore) ap-southeast-1
Asia Pacific (Sydney) ap-southeast-2
Asia Pacific (Tokyo) ap-northeast-1
Asia Pacific (Seoul) ap-northeast-2
Asia Pacific (Osaka) ap-northeast-3
EU (Frankfurt) eu-central-1
EU (Ireland) eu-west-1
EU (London) eu-west-2
EU (Paris) eu-west-3
China (Beijing) cn-north-1
China (Ningxia) cn-northwest-1
South America (São Paulo) sa-east-1

The output option can be either JSON (default), or text.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.181.196