# Connect a client

The endpoint, region and addressing settings for the AWS CLI, rclone, boto3 and the AWS SDKs.

## Settings

| Setting | Value |
| --- | --- |
| Endpoint | `https://s3.orbitfs.io` |
| Region | `auto` |
| Addressing | Path style: `https://s3.orbitfs.io/<drive>/<key>` |
| Signature | AWS Signature Version 4 |
| Credentials | An [access key](https://docs.orbitfs.io/start/access-keys) ID and secret |
| Bucket | A drive's name or its drive ID |

A drive is a bucket. A file's path inside the drive is the object key, and a key ending in `/` is a folder.

## AWS CLI

```sh
export AWS_ACCESS_KEY_ID=ULS...
export AWS_SECRET_ACCESS_KEY=...
export AWS_ENDPOINT_URL=https://s3.orbitfs.io
export AWS_DEFAULT_REGION=auto

aws s3 ls                                   # drives
aws s3 ls s3://my-drive/renders/            # a folder
aws s3 cp ./scene.blend s3://my-drive/renders/scene.blend
aws s3 sync ./renders s3://my-drive/renders
```

`AWS_ENDPOINT_URL` needs AWS CLI 2.13 or later. On older versions pass `--endpoint-url https://s3.orbitfs.io` to each command.

To keep Orbit separate from your AWS account, use a named profile:

```sh
aws configure set aws_access_key_id ULS... --profile orbit
aws configure set aws_secret_access_key ... --profile orbit
aws configure set region auto --profile orbit
aws configure set endpoint_url https://s3.orbitfs.io --profile orbit
aws configure set s3.addressing_style path --profile orbit

aws --profile orbit s3 ls
```

## rclone

```sh
rclone config create orbit s3 provider=Other \
  access_key_id=ULS... secret_access_key=... \
  endpoint=https://s3.orbitfs.io region=auto force_path_style=true

rclone lsd orbit:
rclone sync ./renders orbit:my-drive/renders
```

## Python (boto3)

```python
import boto3
from botocore.config import Config

s3 = boto3.client(
    "s3",
    endpoint_url="https://s3.orbitfs.io",
    region_name="auto",
    aws_access_key_id="ULS...",
    aws_secret_access_key="...",
    config=Config(s3={"addressing_style": "path"}),
)

for drive in s3.list_buckets()["Buckets"]:
    print(drive["Name"])

s3.upload_file("scene.blend", "my-drive", "renders/scene.blend")
head = s3.get_object(Bucket="my-drive", Key="renders/scene.blend", Range="bytes=0-1023")
```

## JavaScript (AWS SDK v3)

```js
import { S3Client, ListObjectsV2Command } from "@aws-sdk/client-s3";

const s3 = new S3Client({
  endpoint: "https://s3.orbitfs.io",
  region: "auto",
  forcePathStyle: true,
  credentials: {
    accessKeyId: process.env.AWS_ACCESS_KEY_ID,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  },
});

const { Contents } = await s3.send(new ListObjectsV2Command({ Bucket: "my-drive", Prefix: "renders/" }));
```

## Large files

A single `PutObject` can carry up to **95 MB**. Above that, use multipart upload. The AWS CLI, rclone and the SDK transfer helpers (`upload_file`, `Upload` in `@aws-sdk/lib-storage`) switch to multipart on their own, so most tools need no change.

If you call `PutObject` directly with a larger body, the request fails. Use the transfer helper instead, or keep each part at or under 95 MB.

## Presigned URLs

Presigned `GET` and `PUT` URLs work. Generate them with the same client configuration:

```sh
aws s3 presign s3://my-drive/renders/scene.blend --expires-in 3600
```

## Errors

Errors use the S3 XML format, and every response carries `x-amz-request-id`. Include that ID when you contact support.

| Status and code | Usual cause |
| --- | --- |
| `403 InvalidAccessKeyId` | The key was mistyped or revoked. |
| `403 SignatureDoesNotMatch` | The secret is wrong. |
| `403 RequestTimeTooSkewed` | The clock on the machine sending the request is off. |
| `403 AccessDenied` | The key's access level doesn't allow the operation. |
| `403 QuotaExceeded` | The workspace is over its storage limit or its plan is inactive. Reads and deletes still work. |
| `404 NoSuchBucket` | The drive doesn't exist, or the key isn't allowed to reach it. |
| `412 PreconditionFailed` | An `If-Match` or `If-None-Match` condition didn't hold. Someone else changed the file. |
| `413` | The body is over the size limit for the request. Use multipart for files over 95 MB. |
| `501 NotImplemented` | The operation isn't supported. See [Supported operations](https://docs.orbitfs.io/s3/operations). |
