

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# `neptune-export` コマンドラインツールを使用して Neptune からデータをエクスポートする
<a name="export-utility"></a>

次の手順を使用して、`neptune-export` コマンドラインユーティリティを使用して Neptune DB クラスターから Amazon S3 にデータをエクスポートできます。

## `neptune-export` コマンドラインユーティリティを使用するための前提条件
<a name="export-utility-setup"></a>

**開始する前に**
+ **JDK のバージョン 8 がある** — [Java SE Development Kit (JDK)](https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html) バージョン 8 をインストールしておく必要があります。
+ **neptune-export ユーティリティをダウンロードする** — [neptune-export.jar](https://s3.amazonaws.com/aws-neptune-customer-samples/neptune-export/bin/neptune-export.jar) ファイルをダウンロードしてインストールします。
+ **`neptune-export` が Neptune VPC にアクセスできることを確認してください** — Neptune DB クラスターがある VPC にアクセスできる場所から neptune-export を実行します。

  たとえば、Neptune VPC 内の Amazon EC2 インスタンス、または Neptune VPC とピアリングされている別の VPC、または別の踏み台ホストで実行できます。
+ **VPC セキュリティグループが `neptune-export` にアクセス権を付与していることを確認します** — Neptune VPC にアタッチされた VPC セキュリティグループが、`neptune-export` 環境に関連付けられている IP アドレスまたはセキュリティグループから DB クラスターへのアクセスを許可していることを確認します。
+ **必要な IAM アクセス許可を設定する**   – データベースで AWS Identity and Access Management (IAM) データベース認証が有効になっている場合は、 `neptune-export` を実行するロールが Neptune への接続を許可する IAM ポリシーに関連付けられていることを確認してください。   Neptune ポリシーの詳細については、[IAM ポリシーの使用](security-iam-access-manage.md) を参照してください。

  クエリリクエストの `clusterId` エクスポートパラメータを使用したい場合、`neptune-export` を実行中のロールには、次の IAM アクセス権限が必要です。
  + `rds:DescribeDBClusters`
  + `rds:DescribeDBInstances`
  + `rds:ListTagsForResource`

  クローンされたクラスターからエクスポートする場合は、`neptune-export` を実行中のロールには、次の IAM アクセス権限が必要です。
  + `rds:AddTagsToResource`
  + `rds:DescribeDBClusters`
  + `rds:DescribeDBInstances`
  + `rds:ListTagsForResource`
  + `rds:DescribeDBClusterParameters`
  + `rds:DescribeDBParameters`
  + `rds:ModifyDBParameterGroup`
  + `rds:ModifyDBClusterParameterGroup`
  + `rds:RestoreDBClusterToPointInTime`
  + `rds:DeleteDBInstance`
  + `rds:DeleteDBClusterParameterGroup`
  + `rds:DeleteDBParameterGroup`
  + `rds:DeleteDBCluster`
  + `rds:CreateDBInstance`
  + `rds:CreateDBClusterParameterGroup`
  + `rds:CreateDBParameterGroup`

  エクスポートされたデータを Amazon S3 に発行するには、`neptune-export` を実行中のロールには、Amazon S3 ロケーションに対して次の IAM アクセス権限が必要です。
  + `s3:PutObject`
  + `s3:PutObjectTagging`
  + `s3:GetObject`
+ **`SERVICE_REGION` 環境変数を設定する** — `SERVICE_REGION` 環境変数を設定して DB クラスターが配置されているリージョンを識別します (リージョン識別子のリストについては[Neptune に接続する](iam-auth-connecting-gremlin-java.md)を参照)。

## `neptune-export` ユーティリティを実行しエクスポート操作を開始する
<a name="export-utility-running"></a>

次のコマンドを使用して、コマンドラインから neptune-export を実行し、エクスポート操作を開始します。

```
java -jar neptune-export.jar nesvc \
  --root-path (path to a local directory) \
  --json (the JSON file that defines the export)
```

コマンドには、2 つのパラメータがあります。

**エクスポート開始時の neptune-Export のパラメータ**
+ **`--root-path`** — エクスポートファイルが Amazon S3 に発行される前に書き込まれるローカルディレクトリへのパス。
+ **`--json`** — エクスポートを定義する JSON オブジェクト。

## `neptune-export` コマンドラインユーティリティを使用したコマンド例
<a name="export-utility-examples"></a>

ソース DB クラスターから直接プロパティグラフデータをエクスポートするには、次の手順を実行します。

```
java -jar neptune-export.jar nesvc \
  --root-path /home/ec2-user/neptune-export \
  --json '{
            "command": "export-pg",
            "outputS3Path" : "s3://(your Amazon S3 bucket)/neptune-export",
            "params": {
              "endpoint" : "(your neptune DB cluster endpoint)"
            }
          }'
```

ソース DB クラスターから直接 RDF データをエクスポートするには、次の手順を実行します。

```
java -jar neptune-export.jar nesvc \
  --root-path /home/ec2-user/neptune-export \
  --json '{
            "command": "export-rdf",
            "outputS3Path" : "s3://(your Amazon S3 bucket)/neptune-export",
            "params": {
              "endpoint" : "(your neptune DB cluster endpoint)"
            }
          }'
```

`command` リクエストパラメーターを省略した場合、デフォルトでは、`neptune-export` ユーティリティは Neptune からプロパティグラフデータをエクスポートします。

DB クラスターのクローンからエクスポートするには、次の手順を実行します。

```
java -jar neptune-export.jar nesvc \
  --root-path /home/ec2-user/neptune-export \
  --json '{
            "command": "export-pg",
            "outputS3Path" : "s3://(your Amazon S3 bucket)/neptune-export",
            "params": {
              "endpoint" : "(your neptune DB cluster endpoint)",
              "cloneCluster" : true
            }
          }'
```

IAM 認証を使用して DB クラスターからエクスポートするには、次の手順を実行します。

```
java -jar neptune-export.jar nesvc \
  --root-path /home/ec2-user/neptune-export \
  --json '{
            "command": "export-pg",
            "outputS3Path" : "s3://(your Amazon S3 bucket)/neptune-export",
            "params": {
              "endpoint" : "(your neptune DB cluster endpoint)"
              "useIamAuth" : true
            }
          }'
```