> For the complete documentation index, see [llms.txt](https://academy.shade.inc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.shade.inc/shade-academy/shade-academy-zh/byos/connecting-shade-to-backblaze.md).

# 将 Shade 连接到 Backblaze

Shade 支持自带 S3（BYOS3），兼容 AWS、GCP、MinIO、Wasabi、Backblaze 等多个提供商。以下是如何将 Shade 连接到您现有的 Backblaze 账户。

### 在 Backblaze 中创建新存储桶

{% hint style="info" %}
虽然并非严格必须配置一个新存储桶，但我们强烈建议为 Shade 配置一个新存储桶。由于 ShadeFS 的特性，Shade 无法使用现有存储桶中的文件。Shade 将创建两个新文件夹 `blobs` 和 `chunks` 到你连接的任何存储桶中。
{% endhint %}

如果您还没有 Backblaze 账户，可以创建一个账户 [这里](https://www.backblaze.com/get-started)。要在 Backblaze 中创建新存储桶，请登录您的账户，进入 Buckets，然后点击“Create Bucket”。

{% hint style="warning" %}
命名存储桶时，请避免使用数字前缀，因为这可能会导致上传失败。
{% endhint %}

<figure><img src="/files/18684b52afb2a19a47849fcb70d9abd2004ba17b" alt=""><figcaption></figcaption></figure>

按照步骤和提示操作时，请务必记住你的 **存储桶名称**，以及你的 **存储桶区域** （这些信息很重要，并会在后续步骤中使用）。 *在本例中，我们的存储桶名称是“shade-new-bucket”，区域（未显示）为 us-east-005。*

<figure><img src="/files/d5cbfed8b237bbf7fd841696c6fe6f20d3e15b20" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
ShadeFS 不要求在该存储桶上设置任何其他特定属性。你可以根据业务需要选择复制数据、记录日志或设置版本控制。
{% endhint %}

### 配置 CORS（更简单的选项，但不一定总是有效）

跨域资源共享（Cross-Origin Resource Sharing）是一项重要特性，它允许存储桶可从其他来源访问（例如 <https://app.shade.inc>）。这对于 Shade 从我们的应用中访问并下载原始媒体至关重要。Backblaze 让共享此来源变得很容易。我们建议允许所有来源。不过，如果您更喜欢更受限制的来源，则需要将其加入白名单 `*.shade.inc` 加入允许来源白名单。

<figure><img src="/files/cae4e804f1244d80b55feb20c4118178c8fbf50b" alt=""><figcaption></figcaption></figure>

### 更新 CORS 的可靠方法

B2 似乎有时在直接从 UI 更新 CORS 时会出现一些问题。要可靠地更新您的 b2 存储桶，您可以使用 [b2 cli](https://www.backblaze.com/docs/cloud-storage-command-line-tools).

#### 创建一个 cors.json

首先，创建一个 `cors.json` 文件，内容如下。

```json
[

  {

    "corsRuleName": "web-any-origin",

    "allowedOrigins": ["*"],

    "allowedHeaders": ["*"],

    "allowedOperations": [

      "b2_download_file_by_id",

      "b2_download_file_by_name",

      "b2_upload_file",

      "b2_upload_part",

      "s3_get",

      "s3_put",

      "s3_delete",

      "s3_head"

    ],

    "maxAgeSeconds": 3000

  }

]
```

然后在您的机器上打开终端并更新：&#x20;

```
b2 bucket update --cors-rules "/path/to/cors.json" your-bucket-name-here allPublic
```

它应返回如下结果：&#x20;

```json
{

    "accountId": "---------",
    "bucketId": "---------",
    "bucketInfo": {},
    "bucketName": "---------",
    "bucketType": "allPublic",
    "corsRules": [
        {
            "allowedHeaders": [
                "*"
            ],
            "allowedOperations": [
                "s3_head",
                "b2_download_file_by_id",
                "b2_upload_part",
                "b2_upload_file",
                "s3_put",
                "b2_download_file_by_name",
                "s3_delete",
                "s3_get"
            ],
            "allowedOrigins": [
                "*"
            ],
            "corsRuleName": "web-any-origin",
            "exposeHeaders": null,
            "maxAgeSeconds": 3000
        }
    ],
    "defaultRetention": {
        "mode": null
    },
    "defaultServerSideEncryption": {
        "mode": "none"
    },
    "isFileLockEnabled": false,
    "lifecycleRules": [],
    "options": [
        "s3"
    ],
    "replication": {
        "asReplicationDestination": null,
        "asReplicationSource": null
    },
    "revision": 5
}
```

### 创建访问密钥

Shade 通过 S3 协议访问 Backblaze 存储桶，这意味着 Shade 需要存储桶名称、存储桶区域、访问密钥和密钥，才能访问该存储桶。

前往 Access Keys > Create Access Key，并创建一个 Master Key 或 Application Key。这里，我们专门为我们的存储桶创建一个应用程序密钥。

<figure><img src="/files/181c4a159d47ce56000386a85f891a49e4f1beb4" alt=""><figcaption></figcaption></figure>

**请确保已启用读取和写入。**

创建新密钥后，将生成的 key ID（Shade 的访问密钥）和 applicationKey（Shade 的密钥）复制到剪贴板，并保存起来，供接下来的几个步骤使用。

<figure><img src="/files/5cd80e89d07fe949e00b2153c8c5ca86062a7813" alt=""><figcaption></figcaption></figure>

### 在 Shade 中创建 BYOS 盘

到这一步，你应该已经成功获取以下项目：

1. Shade 工作区
2. 存储桶名称
3. 存储桶区域
4. KeyID（访问密钥）
5. applicationKey（密钥）

如果你还没有工作区，可以创建一个 [这里](https://app.shade.inc).

在你的 Shade 工作区中，你现在可以创建一个盘。点击“My drives”旁边的加号按钮 > BYOS drive。

<figure><img src="/files/6ccffea698775bea2ad3db5de06a2f36dc812c8c" alt=""><figcaption></figcaption></figure>

#### 选择模板

<figure><img src="/files/79c720789884d916bcfbc479648dc78c74044002" alt=""><figcaption></figcaption></figure>

我们的模板通过额外的元数据和视图帮助你快速使用 Shade，从而帮助你组织文件和素材。有关我们的 AI 的更多信息，你可以查看我们的 [学院](https://academy.shade.inc/ai-tools/custom-and-automated-metadata)。在本例中，我们选择了 Video Production。

#### 创建我们的 Backblaze 驱动

接下来，我们确定驱动名称并选择提供商 Backblaze。

<figure><img src="/files/a41b24f087e568eade038adc5b53d43663113d8d" alt=""><figcaption></figcaption></figure>

#### 添加我们的 Backblaze 凭证

根据前面的步骤，我们添加 Backblaze 凭证，包括存储桶名称、区域、访问密钥和密钥。

{% hint style="info" %}
这必须是您在 Backblaze 中创建的存储桶名称。这与您在前一屏创建的驱动名称不同。
{% endhint %}

<figure><img src="/files/b3f4ffff2f63f82bd29fb7d77a3658ba4492c7d2" alt=""><figcaption></figcaption></figure>

### 上传你的第一个文件

完成前面的步骤后，你现在就可以向你的 Shade 盘上传第一个文件了。如果配置成功，你应该能够上传文件，并从 [Shade 桌面应用](https://shade.inc/download)

<figure><img src="/files/160acccc3a93bd5f3756f4b48d5318d76aebd82f" alt=""><figcaption></figcaption></figure>

### 故障排除提示

如果你有更多问题——欢迎通过以下方式联系我们： <support@shade.inc> 或加入我们的 [Discord](https://discord.gg/h8wqFMJ4vK).

#### 我无法上传，怎么回事？

如果你无法上传，请检查存储桶的 CORS 设置，或者检查你的密钥/访问密钥及其关联权限。


---

# 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://academy.shade.inc/shade-academy/shade-academy-zh/byos/connecting-shade-to-backblaze.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.
