

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用 Neptune-Export 服务导出 Neptune 数据
<a name="export-service"></a>

您可以使用以下步骤，通过 Neptune-Export 服务将数据从 Neptune 数据库集群导出到 Amazon S3：

## 安装 Neptune-Export 服务
<a name="export-service-install"></a>

使用 AWS CloudFormation 模板创建堆栈：

**安装 Neptune-Export 服务**

1. 通过选择下表中的**启动堆栈**按钮之一，在 CloudFormation 控制台中启动 CloudFormation 堆栈：    
[See the AWS documentation website for more details](http://docs.aws.amazon.com/zh_cn/neptune/latest/userguide/export-service.html)

1.  在 **Select Template** 页面上，选择 **Next**。

1. 在模板的**指定详细信息**页面上，设置以下参数：
   + ** `VPC`** –设置 Neptune-Export 服务的最简单方法是将其安装在与 Neptune 数据库相同的 Amazon VPC 中。如果您想将其安装在单独的 VPC 中，则可以使用 [VPC 对等连接](https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html)在 Neptune 数据库集群的 VPC 和 Neptune-Export 服务 VPC 之间建立连接。
   + ** `Subnet1`** –Neptune-Export 服务必须安装在您 VPC 的子网中，该子网允许从该子网到互联网的出站 IPv4 HTTPS 流量。这样，Neptune-Export 服务就可以调用 [AWS Batch API](https://aws.amazon.com/premiumsupport/knowledge-center/batch-job-stuck-runnable-status/) 来创建和运行导出任务。

     如果您使用 Neptune 文档中[创建 Neptune 集群](get-started-create-cluster.md)页面上的 CloudFormation 模板创建了 Neptune 集群，则可以使用该堆栈中的 `PrivateSubnet1` 和 `PrivateSubnet2` 输出来填充此参数和下一个参数。
   + ** `Subnet2`** –VPC 中的第二个子网，允许从该子网到互联网的出站 IPv4 HTTPS 流量。
   + **`EnableIAM`** – 将其设置为 `true` 以使用 AWS Identity and Access Management (IAM) 保护 Neptune-Endpoint API。我们建议您这样做。

     如果您启用 IAM 身份验证，则必须对针对端点的所有 HTTPS 请求进行 `Sigv4` 签名。您可以使用诸如 [awscurl](https://github.com/okigan/awscurl) 之类的工具来代表您签署请求。
   + **`VPCOnly`** – 将它设置为 `true` 将使导出端点成为“仅 VPC”，因此，您只能从安装了 Neptune-Export 服务的 VPC 内对其进行访问。这将 Neptune-Export API 限制为只能在该 VPC 内使用。

     建议您将 `VPCOnly` 设置为 `true`。
   + **`NumOfFilesULimit `** – 在 `ulimits` 容器属性中为 `nofile` 指定一个介于 10000 到 1 百万之间的值。默认值为 10000，除非您的图形包含大量唯一标签，否则我们建议保留默认值。
   + **`PrivateDnsEnabled `**（布尔值）– 指示是否将私有托管区与指定的 VPC 关联。默认值为 `true`。

     在启用此标志的情况下创建 VPC 端点时，所有 API Gateway 流量都将通过 VPC 端点路由，并且公有 API Gateway 端点调用将被禁用。如果将 `PrivateDnsEnabled` 设置为 `false`，则启用公有 API Gateway 端点，但无法通过私有 DNS 端点连接 Neptune 导出服务。然后，您可以使用 VPC 端点的公有 DNS 端点来调用导出服务，详见[此处](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-api-test-invoke-url.html#apigateway-private-api-public-dns)。
   +  **`NeptuneExportVersion`** – 指定要使用的 Neptune Export 实用程序的版本。支持 `v1.1.11` 或以上的所有版本。版本 `v2.latest` 可用于自动接收次要更新。可用版本的完整列表以及补丁说明可以在开源 [GitHub 版本](https://github.com/aws/neptune-export/releases)中找到。

1. 选择**下一步**。

1. 在**选项**页面上，选择**下一步**。

1. 在**审核**页面上，选中第一个复选框以确认 CloudFormation 将创建 IAM 资源。选中第二个复选框以确认新堆栈的 `CAPABILITY_AUTO_EXPAND`。
**注意**  
`CAPABILITY_AUTO_EXPAND` 明确确认在创建堆栈时将扩展宏，而无需事先审核。用户通常通过处理的模板创建更改集，以便在实际创建堆栈之前对宏所做的更改进行审核。有关更多信息，请参阅 CloudFormation [CreateStack](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html) API。

   然后选择**创建**。

## 启用从 Neptune-Export 访问 Neptune
<a name="export-service-access-to-neptune"></a>

Neptune-Export 安装完成后，更新您的 [Neptune VPC 安全组](get-started-vpc.md#security-vpc-security-group)以允许从 Neptune-Export 进行访问。创建 Neptune-Export CloudFormation 堆栈后，**输出**选项卡将包含一个 `NeptuneExportSecurityGroup` ID。更新 Neptune VPC 安全组以允许从该 Neptune 导出任务进行访问。

## 启用从基于 VPC 的 EC2 实例访问 Neptune-Export 端点
<a name="export-service-access-to-service"></a>

如果您将 Neptune-Export 端点设置为仅 VPC，则只能从安装了 Neptune-Export 服务的 VPC 内对其进行访问。要允许从 VPC 中的 Amazon EC2 实例进行连接（您可以从该实例进行 Neptune-Export API 调用），请将 CloudFormation 堆栈创建的 `NeptuneExportSecurityGroup` 附加到该 Amazon EC2 示例。