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

# AWS CLI with LABDRIVE

AWS CLI is a unified tool to manage AWS services. It is frequently the tool used to transfer data in and out of AWS S3. It works with any S3 compatible cloud storage service and it is the recommended way to upload or download content when using LABDRIVE.

In this recipe we will learn how to configure and use AWS CLI to manage data with LABDRIVE.

## 1. Prerequisites

* A working LABDRIVE instance&#x20;
* Your LABDRIVE S3 access and secret keys.

## 2. Installation

Install AWS CLI from <https://aws.amazon.com/cli/>

## 3. Configuration

To configure AWS CLI, type `aws configure` and specify the LABDRIVE key information.

Replace shown keys below with your own keys:&#x20;

```
$ aws configure
AWS Access Key ID [None]: <your access key>
AWS Secret Access Key [None]: <your secret key>
Default region name [None]: (just press ENTER here for None)
Default output format [None]: (just press ENTER here for None)
```

## 4. Commands

Depending on the region and other settings, LABDRIVE keeps your data container inside a particular S3 Bucket. All data containers in your instance may use the same S3 bucket or not.&#x20;

Path to your files is created **using the following convention:**

```bash
s3://{S3 bucket name}/{container id}/{path to your file}
```

To obtain the **Bucket Name** associated to the data container you want to use to begin uploading any file see [Getting your S3 bucket name](/labdrive/cookbook/getting-your-s3-bucket-name.md).

### **List your containers**

This will list the data containers you have in a given S3 bucket:

```
$ aws s3 ls s3://labdrive-acme/
                           PRE 1/
                           PRE 2/
                           PRE 3/
                           PRE 4/
                           PRE 5/
                           PRE 6/

```

Note that the 1/, 2/, etc are your container IDs. Before the container ID you can find a PRE or a date and time, depending on the case.

### List contents inside a container

```
$ aws s3 ls s3://labdrive-acme/5/
2021-02-30 00:26:53      69297 results.root
2021-02-30 00:35:37      67250 mycode-2.5.0.tar.gz
```

###

### Copy files to your container

```
$ aws s3 cp 1.root s3://labdrive-acme/5/1.root
upload: .\1.root to s3://labdrive-acme/5/1.root
```

###

### Up/download recursively&#x20;

```
$ aws s3 cp myFolder s3://labdrive-acme/5/myfolder --recursive
upload: .\myfolder\1.root to s3://labdrive-acme/5/myfolder/1.root
upload: .\myfolder\2.root to s3://labdrive-acme/5/myfolder/2.root
```

### &#x20;<a href="#undefined-2" id="undefined-2"></a>

### Synchronize a local/remote folder <a href="#undefined-2" id="undefined-2"></a>

This will upload/download changed or new files only, and will not delete files not in source.

```
$ aws s3 sync myFolder s3://labdrive-acme/5/myfolder
upload: .\myfolder\3.root to s3://labdrive-acme/5/myfolder/3.root
```

### Delete files from your container

```
$ aws s3 rm s3://labdrive-acme/5/1.root
delete: s3://labdrive-acme/5/1.root
```


---

# 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.libnova.com/labdrive/cookbook/aws-cli-with-labdrive.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.
