Archive · AWS

Installing and Configuring AWS CLI v2

AWS CLI version 2 became generally available in February 2020. Install it and set up a named profile.

1 min read

  • AWS CLI 2.0
  • Ubuntu 20.04 LTS

AWS CLI v2 is a standalone installer that bundles its own Python, and it supports SSO and a nicer output pager.

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscliv2.zip
unzip awscliv2.zip
sudo ./aws/install
aws --version

Configure a named profile with the access key of your IAM user (never the root user):

aws configure --profile mumbai
# region: ap-south-1   output: json
aws sts get-caller-identity --profile mumbai
aws s3 ls --profile mumbai

Keys are stored in ~/.aws/credentials; keep that file private (chmod 600). aws sts get-caller-identity is the quickest way to see which account and user your commands will act as. On servers, prefer IAM roles over stored keys, which a later post covers.