Stop 03 · AWS Account Setup & ToolsTopics · 5/8

Installing & Configuring the AWS CLI

Part of the AWS Roadmap

In short

Almost every AWS tutorial, script and interview task assumes a working CLI. Setting it up properly once, with version 2 and named profiles, saves you from the confusing "which account am I in?" mistakes later.

AWS CLI version 2 is installed from AWS's official installer and configured with credentials and a default Region. Named profiles let you switch between accounts, and IAM Identity Center sign-in (aws configure sso) avoids storing long-term access keys.

The jaadu sorts a big ring of keys, attaching a coloured tag to each key before hanging the ring on a hook next to a row of flat doors.

Think of it like this

A labelled key ring

A caretaker with keys to many flats labels every key: "Flat 302, Andheri". The AWS CLI keeps a labelled key ring in ~/.aws/config. Each profile says which account, which Region and how to get credentials, and you pick one with --profile.

Watch it happen

From download to first command

Install v2
aws --version
Configure SSO
Profile saved
Run commands

1/5Install AWS CLI version 2 from AWS's official installer for your operating system.

The big ideas

What you need to know

Use version 2

v2 is the current CLI, with built-in SSO sign-in, auto-prompt and a bundled Python runtime.

Named profiles

One profile per account and role, such as personal-lab and company-dev. No more editing files to switch.

Prefer short-lived credentials

aws configure sso and aws login give temporary credentials. aws configure with access keys stores long-term secrets on disk.

Set a default Region

Commands go to this Region unless you add --region. Wrong Region is the top reason for 'my instance disappeared'.

See it in code

Walk through the code

bash
1# Linux (x86_64) install of AWS CLI v22curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"3unzip awscliv2.zip4sudo ./aws/install5aws --version6 7# Sign-in through IAM Identity Center and create a profile8aws configure sso9# SSO session name: my-sso10# SSO start URL: https://my-company.awsapps.com/start11# SSO region: ap-south-1  -> pick account and role in the browser12 13aws sso login --profile dev-admin14aws sts get-caller-identity --profile dev-admin

1/4Download the official zip, unzip it and run the bundled installer.

Install v2 on Linux, then create an SSO-based profile. macOS uses the .pkg installer and Windows the .msi.

Save yourself the pain

Common mistakes

Oops

Running aws configure with root access keys.

Do this instead

Never create root keys. Use IAM Identity Center with aws configure sso, or at least an IAM user's keys with limited permissions.

Oops

Forgetting which profile is active and changing the wrong account.

Do this instead

Run aws sts get-caller-identity before anything destructive, and give profiles clear names.

Your mission

Two profiles, zero confusion

~25 min

Quick check

Where does the AWS CLI store named profile settings like Region and SSO details?

Go deeper

  1. 1Install AWS CLI v2 and run aws --version to confirm it works.
  2. 2Configure a profile and run aws sts get-caller-identity to see who you are signed in as.
  3. 3Set up aws configure sso once you reach IAM Identity Center in Phase 4.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge