# How to use AWS CLI v2 and s3cmd with e3 Object Storage

## e3 Object Storage: Linux CLI Guide

Welcome! This guide shows you how to use **AWS CLI v2** and **s3cmd** with **eazyBackup e3 Object Storage**.

You can copy and paste the example commands as-is, replacing the placeholders where noted.

### What You Need

* Your e3 `ACCESS_KEY`
* Your e3 `SECRET_KEY`
* Your bucket name
* Linux shell access

Our S3-compatible endpoint used in examples:

```bash
s3.ca-central-1.eazybackup.com
```

#### Environment variables:

{% hint style="info" %}
Shell variables (like ACCESS\_KEY, SECRET\_KEY, BUCKET, and ENDPOINT) are just named placeholders in your terminal session. We use them in KB examples so you can set your e3 details once, then copy/paste the rest of the commands without editing every line.
{% endhint %}

Set the recommended environment variables in your terminal session:

```bash
export ACCESS_KEY="<YOUR_E3_ACCESS_KEY>"
export SECRET_KEY="<YOUR_E3_SECRET_KEY>"
export ENDPOINT="s3.ca-central-1.eazybackup.com"
export ENDPOINT_URL="https://$ENDPOINT"
export REGION="ca-central-1"
export BUCKET="<YOUR_BUCKET_NAME>"
```

### Option A: AWS CLI v2

AWS CLI is Amazon's official CLI, but it works great with e3 when you provide a custom endpoint.

#### A more permanent setup: use an `e3` profile

Most users prefer a named AWS profile so they do not have to export credentials every time.

1. Create an `e3` profile:

```bash
aws configure --profile e3
```

When prompted:

* AWS Access Key ID: your e3 access key
* AWS Secret Access Key: your e3 secret key
* Default region name: `ca-central-1`
* Default output format: (optional) `json`

2. Set e3-friendly S3 settings for that profile:

```bash
aws configure set region "ca-central-1" --profile e3
aws configure set s3.addressing_style virtual --profile e3
```

#### Where AWS CLI stores credentials (`~/.aws/credentials`)

AWS CLI profiles are stored in two files in your home directory:

* `~/.aws/credentials`: secrets (access keys)
* `~/.aws/config`: profile settings (region, S3 addressing style, etc.)

If you use `aws configure --profile e3`, AWS CLI will create/update these files for you.

You can also create them manually.

Create the directory:

```bash
mkdir -p ~/.aws
chmod 700 ~/.aws
```

Create or edit `~/.aws/credentials`:

```ini
[e3]
aws_access_key_id = YOUR_E3_ACCESS_KEY
aws_secret_access_key = YOUR_E3_SECRET_KEY
```

Lock down permissions:

```bash
chmod 600 ~/.aws/credentials
```

Create or edit `~/.aws/config`:

```ini
[profile e3]
region = ca-central-1
s3 =
  addressing_style = virtual
```

Then use the profile in commands:

```bash
aws --profile e3 --endpoint-url "https://s3.ca-central-1.eazybackup.com" s3 ls
```

Notes:

* You will still supply the e3 endpoint on commands using `--endpoint-url "$ENDPOINT_URL"` (We have found that AWS CLI does not reliably store an endpoint override in the profile for all commands).
* Keeping e3 in its own profile helps avoid accidentally talking to AWS S3 with the same commands.

#### Install AWS CLI v2 on Linux

```bash
curl -L --show-error \
  "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o /tmp/awscliv2.zip
unzip -oq /tmp/awscliv2.zip -d /tmp
sudo /tmp/aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
aws --version
```

#### Configure for e3

```bash
aws configure set default.region "$REGION"
aws configure set default.s3.addressing_style virtual
```

Why `virtual`:

* It uses bucket subdomain style (`bucket.endpoint`), which we recommend for e3.

#### Convenience: an `aws-e3` wrapper (optional)

If you want to avoid typing `--endpoint-url` and `--profile` every time, add this to your shell profile (for example `~/.bashrc`):

```bash
aws-e3() { aws --profile e3 --endpoint-url "https://s3.ca-central-1.eazybackup.com" "$@"; }
```

Then you can run:

```bash
aws-e3 s3 ls
aws-e3 s3 ls "s3://$BUCKET/"
```

#### AWS CLI Examples

List buckets:

```bash
aws --profile e3 --endpoint-url "$ENDPOINT_URL" s3 ls
```

List objects in a bucket:

```bash
aws --profile e3 --endpoint-url "$ENDPOINT_URL" s3 ls "s3://$BUCKET/"
```

Upload a file (PUT):

```bash
echo "hello from e3 via aws cli" > /tmp/e3-aws-test.txt
aws --profile e3 --endpoint-url "$ENDPOINT_URL" s3 cp /tmp/e3-aws-test.txt "s3://$BUCKET/e3-aws-test.txt"
```

Download a file (GET):

```bash
aws --profile e3 --endpoint-url "$ENDPOINT_URL" s3 cp "s3://$BUCKET/e3-aws-test.txt" /tmp/e3-aws-test.downloaded.txt
head -n 1 /tmp/e3-aws-test.downloaded.txt
```

Delete object:

```bash
aws --profile e3 --endpoint-url "$ENDPOINT_URL" s3 rm "s3://$BUCKET/e3-aws-test.txt"
```

Get object metadata:

```bash
aws --profile e3 --endpoint-url "$ENDPOINT_URL" s3api head-object \
  --bucket "$BUCKET" --key "e3-aws-test.txt"
```

### Option B: s3cmd

`s3cmd` is a popular third-party S3 client and works with e3 when configured correctly.

#### Install s3cmd on Linux

Ubuntu/Debian:

```bash
sudo apt-get update
sudo apt-get install -y s3cmd
s3cmd --version
```

#### Configure s3cmd for e3

Create a dedicated config:

```bash
cat > /tmp/e3-s3cmd.cfg <<EOF
[default]
access_key = $ACCESS_KEY
secret_key = $SECRET_KEY
host_base = $ENDPOINT
host_bucket = %(bucket)s.$ENDPOINT
use_https = True
signature_v2 = False
bucket_location =
verbosity = WARNING
EOF
chmod 600 /tmp/e3-s3cmd.cfg
```

{% hint style="info" %}
Important:&#x20;

* Set both `host_base` and `host_bucket`.&#x20;
* If `host_bucket` is missing, `s3cmd` will fall back to the AWS hostname like `bucket.s3.amazonaws.com`, which can cause failures even when keys are correct.
  {% endhint %}

#### s3cmd Examples

List buckets:

```bash
s3cmd -c /tmp/e3-s3cmd.cfg ls
```

List objects in a bucket:

```bash
s3cmd -c /tmp/e3-s3cmd.cfg ls "s3://$BUCKET/"
```

Upload a file (PUT):

```bash
echo "hello from e3 via s3cmd $(date -Is)" > /tmp/e3-s3cmd-test.txt
s3cmd -c /tmp/e3-s3cmd.cfg put /tmp/e3-s3cmd-test.txt "s3://$BUCKET/e3-s3cmd-test.txt"
```

Download a file (GET):

```bash
s3cmd -c /tmp/e3-s3cmd.cfg get "s3://$BUCKET/e3-s3cmd-test.txt" /tmp/e3-s3cmd-test.downloaded.txt
head -n 1 /tmp/e3-s3cmd-test.downloaded.txt
```

Delete object:

```bash
s3cmd -c /tmp/e3-s3cmd.cfg del "s3://$BUCKET/e3-s3cmd-test.txt"
```

Get object info:

```bash
s3cmd -c /tmp/e3-s3cmd.cfg info "s3://$BUCKET/e3-s3cmd-test.txt"
```

### Troubleshooting

#### `InvalidAccessKeyId` with s3cmd

Most common cause:

* `host_bucket` is not set correctly.

Fix:

* Use `host_bucket = %(bucket)s.s3.ca-central-1.eazybackup.com`.

### FAQ

#### Is e3 the same as AWS S3?

e3 is **S3-compatible**, not AWS itself.\
That means most standard S3 tools work, but you will need to provide the e3 endpoint and correct addressing configuration.

#### Which client should I use?

* We prefer **AWS CLI v2** for most workflows.
* Use **s3cmd** if you prefer its command style, but be sure to configure `host_bucket` explicitly.

***

{% hint style="info" %}
Need help? Share your exact command and error output with support, and include whether you are using AWS CLI or s3cmd.
{% endhint %}


---

# 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://docs.eazybackup.com/e3-object-storage/how-to-use-aws-cli-v2-and-s3cmd-with-e3-object-storage.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.
