# How to Use AWS CLI with Stook

The **AWS CLI** is a command-line tool that can be used to transfer data to **Medianova Stook Object Storage**, which is fully compatible with S3 storage services. You can install AWS CLI on Windows, macOS, and Linux to configure Stook, create buckets, and manage objects.

***

### Prerequisites

* AWS CLI installed
* Medianova Stook credentials:
  * **Server**
  * **Access Key**
  * **Secret Key**
* Python (for macOS/Linux installations with pip)

⚠️ Your account information is private. Do not share it.

***

### Installation

#### Windows

1. Download the AWS CLI installer from [AWS CLI official website](https://aws.amazon.com/cli/).
2. Run the setup file (choose 32-bit or 64-bit version).
3. Accept the license agreement, click **Next**, then **Install**.
4. Finish the installation with the **Finish** button.

*Caption: Windows installation wizard for AWS CLI*

#### macOS / Linux

Install AWS CLI with pip:

```bash
pip install awscli
```

***

### Configuration

Run the following command to configure credentials:

```bash
aws configure
AWS Access Key ID [None]: xxxxxxxxxxxxxxxxxx
AWS Secret Access Key [None]: yyyyyyyyyyyyyyyyyyy
Default region name [None]: ENTER
Default output format [None]: ENTER
```

Example credentials:

* **Server**: `xxxxx.mncdn.com`
* **Access Key**: `xxxxxxxxxxxxxxxxxxxx`
* **Secret Key**: `yyyyyyyyyyyyyyyyyyyy`

***

### Commands

#### List Buckets

```bash
aws --endpoint-url https://xxxxx.mncdn.com s3 ls
```

#### List Contents in a Bucket

```bash
aws --endpoint-url https://xxxxx.mncdn.com s3 ls s3://testbucket1
```

#### Create a Bucket

```bash
aws --endpoint-url https://xxxxx.mncdn.com s3 mb s3://bucket2
```

#### Add Objects to a Bucket

```bash
aws --endpoint-url https://xxxxx.mncdn.com s3 cp hello_world.txt s3://mybucket
```

#### Delete Objects

```bash
aws --endpoint-url https://xxxxx.mncdn.com s3 rm s3://mybucket/hello_world.txt
```

#### Remove Buckets

```bash
aws --endpoint-url https://xxxxx.mncdn.com s3 rb s3://mybucket
```

***

### Troubleshooting / FAQ

* **Command not found:** Ensure AWS CLI is installed and added to PATH.
* **Authentication error:** Verify Access Key, Secret Key, and endpoint URL.
* **Permission denied:** Confirm you are using correct credentials.

***

### References

* [AWS CLI Official Website](https://aws.amazon.com/cli/)


---

# Agent Instructions: 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:

```
GET https://clients.medianova.com/products/object-storage-stook/integration-and-usage-guides/how-to-use-aws-cli-with-stook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
