---
title: OCI Object Storage
icon: server
description: Set up the OCI resource in Python.
---

## Dependencies

```bash
uv sync --extra s3
```

OCI Object Storage uses the same `aiobotocore` dependency as S3 because MIRAGE
talks to OCI through its S3-compatible API.

For credential setup, see the [OCI Setup](/home/setup/oci) guide.

## Configuration

```python
import os

from mirage import MountMode, Workspace
from mirage.resource.oci import OCIConfig, OCIResource

config = OCIConfig(
    bucket=os.environ["OCI_BUCKET"],
    namespace=os.environ["OCI_NAMESPACE"],
    region=os.environ["OCI_REGION"],
    access_key_id=os.environ["OCI_ACCESS_KEY_ID"],
    secret_access_key=os.environ["OCI_SECRET_ACCESS_KEY"],
)
resource = OCIResource(config)
ws = Workspace({"/oci/": resource}, mode=MountMode.READ)
```

The resource derives the default OCI S3 endpoint as:

```text
https://<namespace>.compat.objectstorage.<region>.oci.customer-oci.com
```

It also forces path-style S3 addressing, which is the safest default for OCI.

## Config Reference

| Field               | Required | Default | Description                        |
| ------------------- | -------- | ------- | ---------------------------------- |
| `bucket`            | Yes      |         | OCI bucket name                    |
| `namespace`         | Yes      |         | Object Storage namespace           |
| `region`            | Yes      |         | OCI region                         |
| `endpoint_url`      | No       | `None`  | Custom endpoint override           |
| `access_key_id`     | Yes      |         | OCI Customer Secret Key access key |
| `secret_access_key` | Yes      |         | OCI Customer Secret Key secret     |
| `timeout`           | No       | `30`    | Request timeout in seconds         |
| `proxy`             | No       | `None`  | HTTP proxy URL                     |

## Example Layout

If your bucket is `mirage` and your objects live under the `data/` prefix, they
appear under the mount like this:

```text
/oci/data/example.json
/oci/data/example.jsonl
```
