How To Setup AWS CLI Tool in Ubuntu in 4 Easy Steps

Reading Time: 2 minutes

AWS CLI is a command-line tool to manage your AWS services. With the help of this tool, you can manage multiple AWS services from the command line as well as you can create services and you can automate them through bash scripting. You can use a multi-user setup to manage services in different accounts.

PreRequisites of AWS CLI

  1. An AWS account
  2. Linux Machine
  3. curl util –> sudo apt install curl

Step 1: Install AWS CLI tool

1.1 Install AWS CLI zip file as name awscliv2.zip

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

1.2 Extract files from awscliv2.zip. It will extract in the same directory with name aws

unzip awscliv2.zip

1.3 Now install the AWS CLI tool

sudo ./aws/install

1.4 Check AWS-CLI is installed successfully

aws --version

It should give output like:

aws-cli/2.4.7 Python/3.8.8 Linux/5.11.0-43-generic exe/x86_64.ubuntu.20 prompt/off

Step 2: Create IAM User in Your AWS account

2.1 Open AWS console, then navigate to IAM console

IAM dashboard

2.2 In the left sidebar choose Users then hit Add Users

IAM users

2.3 Enter the name of user -> Check the box (Access key) -> then hit Enter Permissions

IAM users

2.4 Create a group

IAM users and groups

2.5 Enter group name -> Select policies -> hit create group

IAM policies

2.6 Select newly created group -> Add Tag (optional) -> Review the user -> Create User

Step 3: Create access key and Secret access for your user

3.1 Open IAM console
3.2 Select the newly created user

3.3 Navigate to Security Credentials

3.4 Create Access key

This will create new keys that are access key and secret access key

3.5 Download credentials.csv file to use these creds in future

Step 4: Configure cli Tool

4.1 Open Terminal

4.2 Configure the tool

Run the command and Enter the access key, secret key, region, output format

aws configure

Enter the values from credentials.csv and find your region in AWS console

AWS Access Key ID [****************JUJC]: <your-access-key>
AWS Secret Access Key [****************R42+]: <your-secret-access-key>
Default region name [ap-south-1]: <your-aws-region>
Default output format [json]: <json,yaml,table>
knoldus footer

Written by 

Rahul Soni is a Software Intern at Knoldus Software. He is always charged up for new things & learnings. He is dedicated to his work and believes in quality output. He loves to take deep dives into cloud technologies & different tools.

1 thought on “How To Setup AWS CLI Tool in Ubuntu in 4 Easy Steps3 min read

Leave a Reply