Skip to content

Know how to install and use AWS CLI in 2 easy steps.

This post aims to provide all the required information on how to install and use AWS CLI (Command-line Interface).

Step 1: – Download the AWS CLI installation file and install:

AWS CLI v2 (Windows) installer- https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html

AWS CLI v2 (macOS) installer – https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html

AWS CLI v2 (Linux) installer – https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html

Install the CLI for your operating system.

Open the command prompt and type in “aws –version” — it should show the AWS version information like “aws-cli/2.2.39 Python/3.8.8 Windows/10 exe/AMD64 prompt/off”, this means the AWS CLI has been installed successfully.

Step 2: Configure Command Line Interface

We need to configure a set of credentials that the CLI will use to be able to access the AWS account.

Follow the following commands in the command prompt to configure CLI

> aws configure (If you just use configure command then it will configure the default configuration profile, it will be used if we don’t use named profile) We will going to use named profile, which is the best practice using the configuration profile. To configure a named profile follow the following steps in the command line.

C:\Users\Admin>aws configure --profile userlearncli
AWS Access Key ID [None]: AKIAVNCHW25DO7PMNDNVADFS 
AWS Secret Access Key [None]: yUs8oomRYvodfaJLdkZsU2N/7W4eGC1Zli06dOzb4zs
Default region name [None]: us-east-1
Default output format [None]:

In the first line provide the name for the profile “user-learncli”
In the second line provide the access key ID, Secret Key of your account (check your access key in your account under My Security Credentials). In the default, region provide your default working region and for the output format, you can leave it empty to use the default of None. (Note: these Access key and secret keys are fake, you should never expose your access key and secret key)

Check if it is working by trying to list the S3 bucket from the account.

C:\Users\Admin>aws s3 ls

Unable to locate credentials. You can configure credentials by running "aws configure".

AWS is saying it couldn’t find the credentials and asks to configure credentials again. Does this mean it is not configured yet? No – this is because we configured the named profile so we need to provide the profile name for AWS to know which account to go and check.

C:\Users\Admin>aws s3 ls --profile userlearncli

C:\Users\Admin>

After you specify the profile name then it works, and since we don’t have any S3 buckets in the account it simply returned an empty value.

Well now you can successfully access your AWS account.

Leave a Reply

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