AWS CLI Cheatsheet

This page contains a cheat sheet with useful AWS commands

AWSCLI

How to install:

# Arch Linux:
sudo pacman -S awscli

# Redhat based or Debian based:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Or install via PIP

pip3 install awscli --upgrade --user

Resources:

How to remove:

sudo rm -rf /usr/local/aws
sudo rm /usr/local/bin/aws

Check awscli version:

aws --version

Configure cloud access

aws configure
  • Add key

  • Add Secret Key

  • Add Region

  • Add Format

The above values can be obtained by using programmatic access (Access keys) via IAM Service

S3 commands

How to check Total S3 bucket size:

aws s3 ls --summarize --human-readable --recursive <BUCKET_NAME> | grep "Total Size"

Lightsail commands

Restart Instance:

aws lightsail reboot-instance --instance-name <insance_name>

Stop Instance:

aws lightsail stop-instance --instance-name <insance_name>

Start Instance:

aws lightsail start-instance --instance-name <insance_name>

Last updated