Using AWS CLI for managing AWS Resources

Jump to navigation Jump to search

Installing AWS CLI

  • Login to the machine using privileged account.
  • Download the latest build of AWS CLI.
  • Windows download instruction and location:
  • Linux download instruction and location:

How to configure AWS Account and Access Keys

  • Login to the IAM Console:
  • From the left pane, click on Users -> click on “Add user” -> specify the user name -> access type: “Programmatic access” -> do not select “AWS Management Console access” -> click “Next: Permissions”
  • From the “add user to group”, either select existing group or click on “Create group” -> click “Next: Review” -> click on “Create user”
  • Download the CSV file with the “Access key ID” and “Secret access key” and save the CSV file in a secure location
  • Click Close

Configuring the AWS CLI

  • Run the command below in-order to configure AWS CLI:
aws configure –profile <profile_name>
  • Profile name – set relevant target profile name
  • AWS Access Key ID - Specify the value from the CSV of the previously created IAM user
  • AWS Secret Access Key - Specify the value from the CSV of the previously created IAM user
  • Default region name - Specify a region such as eu-west-1
Full list:
  • Default output format - JSON
Note 1: By default, the credentials file is stored here:
  • On Windows: C:\Users\username\.aws\credentials
  • On Linux: ~/.aws/credentials
Note 2: Reference about configuration and credential file settings can be found at:

Storage related commands

  • Create a new S3 bucket:
aws s3 mb <BucketName>
  • Remove S3 bucket:
aws s3 rb s3://<BucketName> --force
  • List all S3 buckets:
aws s3 ls
  • List of S3 buckets using additional AWS IAM account:
aws s3 ls --profile [profile_name]
  • List the content of specific S3 bucket:
aws s3 ls s3://<BucketName>
  • Copy file from S3 bucket to local directory:
aws s3 cp s3://<BucketName>/<FileName> /<LocalFolderName>


  • Installing the AWS Command Line Interface
  • 28 Essential AWS S3 CLI Command Examples to Manage Buckets and Objects