# 向部署上传文件

{% hint style="info" %}
此功能当前仅可通过 [如果您希望使用 A/B 策略执行迁移，只需启动一个新的匹配器。它将在新集群上并具有新 URL。在您将游戏客户端中的 URL 替换后，删除旧的即可。此方法可将潜在中断降至最低并确保无缝过渡。](/zh/docs/api.md).
{% endhint %}

可以将您 S3 存储桶中的文件上传到部署。由于文件仅在创建部署时下载，您可以在存储桶中修改文件，并在下一次创建的部署中看到更改。

### 拉取配置文件

拉取配置文件定义了应从您的 S3 存储桶下载哪些文件或文件夹以及将它们保存到部署中的何处。

在创建拉取配置文件之前，请确保您至少有一个 [端点存储](/zh/docs/endpoint-storage.md) 已配置。

然后您需要在此存储桶中创建一个拉取配置文件，包含以下信息：

* 该 **name** 拉取配置文件的名称：此名称将用于稍后将拉取配置文件关联到您的应用版本，因此应具有唯一性和描述性。
* 该 **源** path：S3 存储桶中要下载的文件或文件夹的路径。它应以斜杠开头，其根是存储桶的根目录。
* 该 **source\_type**：此项可以是“file”或“folder”，必须正确设置才能成功下载。
* 该 **目标** path：文件或文件夹将在部署中保存的路径。它应以斜杠开头，其根是容器镜像的根目录。

{% hint style="warning" %}
请确保避免使用受保护的目标位置，例如 `/etc/`，因为这将阻止文件被复制到您的部署并导致部署失败。确保普通用户可以向目标文件夹写入。
{% endhint %}

例如，如果您想将存储桶中的文件 `some-file.txt`，复制到您部署中的 `custom-folder` 文件夹，且两种文件结构如下所示：

```
s3://my-bucket/
├─ some-folder/
│  ├─ some-file.txt
├─ some-other-folder/
│  ├─ some-other-file.jpg
```

```
/
├─ app/
│  ├─ entrypoint.sh
│  ├─ custom-folder/

```

您将使用以下信息创建拉取配置文件：

```json
{
  "name": "some-file-pull-profile",
  "source": "/some-folder/some-file.txt",
  "source_type": "file",
  "destination": "/app/custom-folder/"
}
```

有关更多详细信息， [请参阅 API 文档](/zh/docs/api.md).

### 将拉取配置文件链接到应用版本

创建拉取配置文件后，您必须将一个应用版本链接到它，以便在创建部署时下载这些文件。这样，您可以为单个应用版本使用多个拉取配置文件，并在应用版本之间重用拉取配置文件。

[参见 API 文档](/zh/docs/api.md)

### 限制

下载到部署的文件总大小不能超过 5 MB。

如果达到此限制，部署时会收到通知，以便您及时解决该问题。


---

# 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:

```
GET https://docs.edgegap.com/zh/docs/endpoint-storage/upload-files.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.
