# Alibaba Cloud OSS

This guide describes how to configure [Alibaba Cloud OSS](https://intl.aliyun.com/product/oss) as Alluxio's under storage system.

Alibaba Cloud Object Storage Service (OSS) is a massive, secure and highly reliable cloud storage service provided by Alibaba Cloud. OSS provides multiple storage classes to help you manage and reduce storage costs.

For more information about Alibaba Cloud OSS, please read its [documentation](https://www.alibabacloud.com/help/en/oss/)

## Prerequisites

Before you get started, please ensure you have the required information listed below:

| `<OSS_BUCKET>`            | [Create a new bucket in the OSS console](https://www.alibabacloud.com/help/en/oss/getting-started/create-buckets-6#task-2013189) or use an existing bucket                                               |
| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `<OSS_DIRECTORY>`         | The directory you want to use in the bucket, either by creating a new directory or using an existing one                                                                                                 |
| `<OSS_ACCESS_KEY_ID>`     | ID used to identify a user. See [How to Obtain AccessKey Pair](https://www.alibabacloud.com/help/en/sls/developer-reference/accesskey-pair)                                                              |
| `<OSS_ACCESS_KEY_SECRET>` | Secret used to verify the identity of the user. See [How to Obtain AccessKey Pair](https://www.alibabacloud.com/help/en/sls/developer-reference/accesskey-pair)                                          |
| `<OSS_ENDPOINT>`          | Endpoints are the domain names that other services can use to access OSS. See [Regions and OSS Endpoints in the Public Cloud](https://www.alibabacloud.com/help/en/oss/user-guide/regions-and-endpoints) |

## Basic Setup

For the general mount mechanism and `UnderFileSystem` CR field reference, see [Underlying Storage](/ee-ai-en/ai-3.8-15.1.x/ufs.md#basic-mount-setup).

{% tabs %}
{% tab title="Kubernetes (Operator)" %}
An example `ufs.yaml` to create an OSS mount point with the operator:

```yaml
apiVersion: k8s-operator.alluxio.com/v1
kind: UnderFileSystem
metadata:
  name: alluxio-oss
  namespace: alx-ns
spec:
  alluxioCluster: alluxio-cluster
  path: oss://<OSS_BUCKET>/<OSS_DIRECTORY>
  mountPath: /oss
  mountOptions:
    fs.oss.accessKeyId: <OSS_ACCESS_KEY>
    fs.oss.accessKeySecret: <OSS_ACCESS_KEY_SECRET>
    fs.oss.endpoint: <OSS_ENDPOINT>
```

{% endtab %}

{% tab title="Docker / Bare-Metal" %}
An example command to mount `oss://<OSS_BUCKET>/<OSS_DIRECTORY>` to `/oss` if not using the operator:

```shell
bin/alluxio mount add --path /oss/ --ufs-uri oss://<OSS_BUCKET>/<OSS_DIRECTORY> \
  --option fs.oss.accessKeyId=<OSS_ACCESS_KEY> --option fs.oss.accessKeySecret=<OSS_ACCESS_KEY_SECRET> \
  --option fs.oss.endpoint=<OSS_ENDPOINT>
```

Note that if you want to mount the root of the OSS bucket, add a trailing slash after the bucket name (e.g. `oss://OSS_BUCKET/`).
{% endtab %}
{% endtabs %}

## Advanced Setup

Note that configuration options can be specified as mount options or as configuration properties in `conf/alluxio-site.properties`.\
The following sections will describe how to set configurations as properties, but they can also be set as mount options via `--option <key>=<value>`.

### Enabling HTTPS

To enable the use of the HTTPS protocol for secure communication with OSS with an additional layer of security for data transfers,\
configure the following setting in conf/alluxio-site.properties:

```properties
alluxio.underfs.oss.secure.http.enabled=true
```

### OSS multipart upload

We use multipart-upload method to upload one file by multiple parts, every part will be uploaded in one thread. It won't generate any temporary files while uploading.

There are other parameters you can specify in `conf/alluxio-site.properties` to potentially speed up the upload.

```properties
# Timeout for uploading part when using multipart upload.
alluxio.underfs.object.store.multipart.upload.timeout
```

```properties
# Thread pool size for OSS multipart upload.
alluxio.underfs.oss.multipart.upload.threads
```

```properties
# Multipart upload partition size for OSS. The default partition size is 16MB.
alluxio.underfs.oss.multipart.upload.part.size
```

Disable OSS multipart upload, the upload method uploads one file completely from start to end in one go. you need to modify `conf/alluxio-site.properties` to include:

```properties
alluxio.underfs.oss.multipart.upload.enabled=false
```

### Setting Request Retry Policy

For retry configuration that applies to all object store UFS types, see [Request Retry Policy](/ee-ai-en/ai-3.8-15.1.x/ufs.md#request-retry-policy) in the UFS overview.


---

# 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://documentation.alluxio.io/ee-ai-en/ai-3.8-15.1.x/ufs/aliyun-oss.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.
