Hills 🏔 and Skills, What's Common?

They both need you to be on top.

Cohort-1 just ended. You will get:

All yours, just at:

$99

How to setup AWS CLI from scratch in 5 minutes

Updated on
aws cli setup banner

Setting up AWS CLI can be painful, but it doesn’t have to be anymore.

All you need to do is follow our no-fluff guide and set up your AWS CLI for success with crystal-clear instructions in under 5 minutes.

Let’s start with installing the CLI

For Linux / MacOS users

Install homebrew if you don’t have it already

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

If you use Arch BTW ;)

yay -Sy aws-cli-v2

Install AWS CLI using brew

brew install awscli
aws cli brew install complete

Your AWS CLI will be installed in no time.

For Windows users

Install chocolatey chocolatey if you don’t have it already:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Finally install AWS CLI using choco

choco install awscli
aws cli installed with choco

If this method didn’t work for you, you can try the MSI installer method described in this tutorial

Let’s create an IAM user for our AWS CLI!

Login to your AWS Console with admin access.

Go to your IAM User console.

Click on the Add Users button on the top-right of the Console.

aws iam add user

Enter a username, e.g. my-cli-user.

Don’t use your existing IAM user, creating a sepaarate IAM user for CLI will help you pinpoint your activity logs in CloudTrail. Another article will be what happens when you accidentally make your Access Key public.

aws create user page

Click Next.

On the next screen, from the three options, select “Attach Policies Directly”. From the “Permissions’ Policies” tab, check the option AdministratorAccess. Scroll down and click Next.

aws iam attach direct policy

To finish things off, on the Review and Create screen, simply click on Create User.

We see that our new user my-cli-user has been created successfully.

aws iam user created

Generating Access Key and Secret for the CLI user

Click on my-cli-user.

Visit the Security credentials tab.

Scroll down and go to the Access Keys section, and click on Create Access Key button.

aws iam create access key

Select the Command Line Interface (CLI) option.

Scroll down and check the box for I understand the above recommendation and want to proceed to create an access key and hit Next.

Setting description tag is optional. Go ahead and click on Create Access Key.

aws iam access key cli option

Your access key has been created. You can simply download the .CSV file if you want to reuse it.

It won’t be shown again.

aws iam retrieve access key

Configuring AWS CLI

To configure AWS CLI in our computer, run the following command.

aws configure --profile cli-user

INFO: You can omit the --profile cli-user part if you don’t plan on using multiple users.

It will ask for the following:

This is how it should look:

AWS Access Key ID [None]: AKIAS75KUR6WAVS3L3NE
AWS Secret Access Key [None]: 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
Default region name [None]: us-east-1
Default output format [None]: json

Now you are all set.

aws cli hard hard work meme

Testing your AWS CLI

Run the following command to know your IAM identity:

aws sts get-caller-identity --profile cli-user

You will see your user Id and ARN:

{
  "UserId": "AIDAS75KUR6WHT3V6PS25",
  "Account": "205979422636",
  "Arn": "arn:aws:iam::205979422636:user/my-cli-user"
}

This means you have set up everything properly and you can use AWS CLI to its full potential.

From here you can take your productivity to the next level.

Here are the list of things you can do with AWS CLI:

The possibilities are endless, you just have to think about it.

I hope you enjoyed reading this article and I solved your problem. If not, feel free to reach out to us, we’ll be happy to help.