> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 专用部署私有网络

一些企业客户需要 Devin 通过私有网络连接到其内部系统，例如 GitHub Enterprise Server、GitLab、Bitbucket Data Center、Artifactory、Nexus 或其他开发基础设施。

Devin 的专用部署通过 AWS PrivateLink 实现这一能力。这种模式会将所有流量限定在 AWS 主干网上，避免暴露在公共互联网中。

<div id="overview">
  ## 概览
</div>

PrivateLink 为你的 Devin 专用部署 环境与内部端点之间提供私有 IP 连接。要启用此功能，你的团队需要在每个 Devin 需要访问的内部系统前配置一个 AWS VPC Endpoint Service 作为入口。随后，Cognition 会创建使用该服务的 Interface VPC Endpoint。
PrivateLink 是按域名配置的。如果 Devin 需要访问多个域名，你需要为每个域名各配置一个 Endpoint Service 和一个 Interface Endpoint。

<div id="requirements">
  ## 要求
</div>

您需要提供：

* 您的 AWS 账户中用于暴露每个内部服务 (GitLab、Artifactory 等) 的 Network Load Balancer (NLB)
* 使用该 NLB 作为目标的 VPC Endpoint Service
* 每个 Endpoint Service 的服务名称
* 包含 Cognition AWS 账户的允许主体 (principal) 权限配置
* 每个服务所支持/开放端口的确认信息
* Devin 需要进行私有解析的域名的 DNS 信息

Cognition 将提供：

* 需要添加为允许主体的 AWS 账户 ID
* 在建立连通性后由 Devin 侧进行的 DNS 配置

<div id="cross-region-privatelink-if-your-services-are-in-a-different-region">
  ## 跨区域 PrivateLink (如果您的服务位于其他区域)
</div>

如果您的内部服务运行所在的区域与 Cognition 专用部署 租户不同，仍然可以使用 PrivateLink。只要服务所有者启用相关功能，AWS 就支持跨区域使用终端节点。

<div id="customer-steps">
  ### 客户端步骤
</div>

1. **创建或复用 Network Load Balancer**
   NLB 应该指向 Devin 需要访问的内部系统，并且必须支持所有所需端口。

2. **从 NLB 创建一个 VPC Endpoint Service**
   这会使该服务可以通过 PrivateLink 进行访问。

3. **启用跨区域（Region）支持**
   在 AWS 控制台中：

   ```
   VPC Console → Endpoint Services → Select service → Actions → Modify supported Regions
   ```

   添加部署你 Cognition 租户的区域（Region）。
   CLI 示例：

   ```bash theme={null}
   aws ec2 modify-vpc-endpoint-service-configuration \
       --service-id vpce-svc-0abc123 \
       --add-supported-regions us-west-2  # 你的 Cognition 租户所在的区域
   ```

4. **将 Cognition 的 AWS 账户添加为允许的主体（principal）**
   ```bash theme={null}
   aws ec2 modify-vpc-endpoint-service-permissions \
       --service-id vpce-svc-0abc123 \
       --add-allowed-principals arn:aws:iam::<COGNITION_ACCOUNT_ID>:root
   ```

5. **向 Cognition 提供以下信息**
   * Endpoint Service 名称\
     示例：`com.amazonaws.vpce.us-west-2.vpce-svc-0abc123`
   * 服务监听的端口
   * 应通过 PrivateLink 解析的域名

<div id="what-happens-next">
  ### 接下来会发生什么
</div>

在你提供上述信息后，Cognition 将：

1. 在你专属的租户环境中，使用你提供的服务名称，**创建 Interface VPC 终端节点（Interface VPC Endpoints）**。
2. **发送连接请求**，你需要对其进行批准（可以手动批准，或在已配置的情况下通过自动接受）。
3. **配置 DNS**，使你指定的域名在 Devin 环境内进行私有解析。

<div id="architecture-diagram">
  ## 架构图
</div>

<Frame caption="从 Cognition 到客户内部服务的跨区域 PrivateLink 连通性">
  <img src="https://mintcdn.com/cognitionai/_hZBHYl9TFGuS5cH/images/privatelink-architecture.svg?fit=max&auto=format&n=_hZBHYl9TFGuS5cH&q=85&s=684c4a1bca883659a78dfd25753c24eb" alt="PrivateLink 架构" width="900" height="480" data-path="images/privatelink-architecture.svg" />
</Frame>

<div id="gateway-load-balancer-gwlb-support">
  ## Gateway Load Balancer (GWLB) 支持
</div>

如果贵组织使用 Zscaler 等安全设备进行流量检查，可以使用 AWS Gateway Load Balancer (GWLB) 来替代 Network Load Balancer。这样可以在 Devin 的流量到达内部服务之前，先通过安全设备进行检查。

在这种架构中：

* **Gateway Load Balancer** 作为前端，位于安全设备之前（例如 Zscaler）
* 在 Devin 环境中创建一个 **Gateway Load Balancer Endpoint**，将流量通过该设备进行路由
* 流量由安全设备检查后，再转发到目标内部服务

要使用该方案，请向 Cognition 提供：

* GWLB Endpoint Service 名称
* 安全设备厂商及其配置详情
* 需要通过 GWLB 路由的域名

<Note>
  基于 GWLB 的部署遵循与基于 NLB 的 PrivateLink 相同的原则，但额外增加了一层流量检查。请联系您的 Cognition 客户团队以获取详细的部署指导。
</Note>

<div id="key-considerations">
  ## 关键注意事项
</div>

| 主题    | 指导说明                                            |
| ----- | ----------------------------------------------- |
| 必要的配置 | 每个域一个 Endpoint Service，每个域一个 Interface Endpoint |
| 跨区域支持 | 必须在 Endpoint Service 上显式启用                      |
| 允许的主体 | 客户必须将 Cognition 的 AWS 账户 ID 添加为允许的主体            |
| DNS   | 客户域名将在 Cognition 侧解析到私有的 Interface Endpoint IP  |
| 端口    | NLB 监听器必须与 Devin 用于访问各服务的端口保持一致                 |
| 可用性   | NLB 及其后端目标应配置在多个可用区                             |
| 延迟    | 由于流量保持在 AWS 主干网上，跨区域延迟可能会略有增加                   |

<div id="information-to-provide-to-cognition">
  ## 需要提供给 Cognition 的信息
</div>

当你的环境配置完成后，请向 Cognition 提供：

* 每个内部域名对应的 AWS Endpoint Service 名称
* （如适用）已启用跨区域支持的确认
* Allowed principal 配置已完成的确认
* NLB 暴露的端口
* 需要通过 PrivateLink 路由的域名列表

随后，Cognition 会创建 Interface Endpoints、配置 DNS，并确认连通性。
