aws aws-cli

AWS CLI – download, install and configure

What is AWS CLI?

The AWS CLI is an open source tool that enables you to interact with AWS services using commands in your command-line shell. With minimal configuration, you can start using functionality equivalent to that provided by the browser-based AWS Management Console from the command prompt in your favorite terminal program as mentioned below:

Linux shell – bash | zsh | tsch
Windows – PowerShell | Command Prompt
Remotely – Putty | SSH | Amazon EC2 systems manager

How AWS CLI Call works?

Boto core is the library which powers the AWS SDK for Python and AWS CLI. So, what happens is, Whenever there is a call to AWS API, there is a HTTP response which is first parsed by Boto core (It applies the filters like query supplied by the user) and then the data is handed over to the user.

Installation Methods:

Note – Whatever method from the above you chose, make sure that the cli binary is in your PATH variable.

Linux – pip (A package manager for Python) | apt | yum
Windows – MSI Installer (64 bit) | pip
MacOS – Bundled Installer | pip
Virtualenv – pip
Bundled Installer – Can install the cli offline
Note – Whatever method from the above you chose, make sure that the cli binary is in your PATH variable.

 

Configuration:

For general use, the aws configure command is the fastest way to set up your AWS CLI installation. It is configured by running this command:

$ aws configure
AWS Access Key ID [None]: (Get it from the IAM service in Console)
AWS Secret Access Key [None]: (Get it from the IAM service in Console)
Default region name [None]: The region in which you are working
Default output format [None]: json | text | table

When you type this command, the AWS CLI prompts you for four pieces of information and stores them in a profile (a collection of settings) named default. This profile is then used any time you run an AWS CLI command that doesn’t explicitly specify a profile to use.

If you just type aws configure and enter the above four pieces of information, then you have actually configured a default profile however if you pass the –profile parameter and give some name (e.g. user2 in the below example), then we are configuring an additional aws cli profile for user2 as shown below:

$ aws configure --profile user2
AWS Access Key ID [None]: (Get it from the IAM service in Console)
AWS Secret Access Key [None]: (Get it from the IAM service in Console)
Default region name [None]: The region in which you are working
Default output format [None]: json | text | table

Note – To run a command with default profile, type:

aws service_name command_name or aws service_name command_name --profile default , however, if user2 wants to run the same command, he will have to type:
aws service_name command_name --profile user2

Now that you have configured the AWS CLI either the default or the named profile, you can start using the AWS CLI by running some commands mentioned in the AWS CLI command reference document.

Leave a Reply

Your email address will not be published. Required fields are marked *

19 − 13 =