> For the complete documentation index, see [llms.txt](https://docs.arkannis.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arkannis.net/cloud/aws/aws-cli-cheatsheet.md).

# AWS CLI Cheatsheet

### AWSCLI

#### How to install:

```bash
# 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

```bash
pip3 install awscli --upgrade --user
```

#### Resources:

* [Install AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)

#### How to remove:

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

#### Check awscli version:

```bash
aws --version
```

### Configure cloud access

```bash
aws configure
```

* Add key
* Add Secret Key
* Add Region
* Add Format

{% hint style="info" %}
The above values can be obtained by using programmatic access (Access keys) via IAM Service
{% endhint %}

![](/files/6SSeNyr5EvifgPqfDSJZ)

### S3 commands

#### How to check Total S3 bucket size:

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

### Lightsail commands

#### Restart Instance:

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

#### Stop Instance:

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

#### Start Instance:

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.arkannis.net/cloud/aws/aws-cli-cheatsheet.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
