

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

# Neptune をターゲットとする AWS DMS レプリケーションタスクの作成
<a name="dms-neptune-replication"></a>

テーブルマッピングおよびグラフマッピング設定を作成したら、次のプロセスを使用してソースストアから Neptune にデータをロードします。問題の APIs の詳細については、 AWS DMS ドキュメントを参照してください。

## AWS DMS レプリケーションインスタンスを作成する
<a name="dms-neptune-replication-instance"></a>

Neptune DB クラスターが実行されている VPC にレ AWS DMS プリケーションインスタンスを作成します (「 AWS DMS ユーザーガイド[」の AWS 「DMS レプリケーションインスタンス](https://docs.aws.amazon.com/dms/latest/userguide/CHAP_ReplicationInstance.html)と [CreateReplicationInstance](https://docs.aws.amazon.com/dms/latest/APIReference/API_CreateReplicationInstance.html) の使用」を参照）。これを行うには、次のような AWS CLI コマンドを使用できます。

```
aws dms create-replication-instance \
    --replication-instance-identifier {{(the replication instance identifier)}} \
    --replication-instance-class {{(the size and capacity of the instance, like 'dms.t2.medium')}} \
    --allocated-storage {{(the number of gigabytes to allocate for the instance initially)}} \
    --engine-version {{(the DMS engine version that the instance should use)}} \
    --vpc-security-group-ids {{(the security group to be used with the instance)}}
```

## ソースデータベースの AWS DMS エンドポイントを作成する
<a name="dms-neptune-source-endpoint"></a>

次のステップでは、ソースデータストアの AWS DMS エンドポイントを作成します。 AWS CLI 次のような で AWS DMS [CreateEndpoint](https://docs.aws.amazon.com/dms/latest/APIReference/API_CreateEndpoint.html) API を使用できます。

```
aws dms create-endpoint \
    --endpoint-identifier {{(source endpoint identifier)}} \
    --endpoint-type source \
    --engine-name {{(name of source database engine)}} \
    --username {{(user name for database login)}} \
    --password {{(password for login)}} \
    --server-name {{(name of the server)}} \
    --port {{(port number)}} \
    --database-name {{(database name)}}
```

## Neptune がステージングデータに使用する Amazon S3 バケットをセットアップする
<a name="dms-neptune-s3-staging-bucket"></a>

ステージングデータに使用できる Amazon S3 バケットがない場合は、Amazon S3 入門ガイドの[バケットの作成](https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingABucket.html)、またはコンソールユーザーガイドの[S3 バケットを作成する方法](https://docs.aws.amazon.com/AmazonS3/latest/userguide/create-bucket.html)の説明に従ってバケットを作成します。

バケットに `GetObject`、`PutObject`、`DeleteObject`、および、`ListObject` アクセス許可を付与する IAM ポリシーを作成する必要があります (まだない場合)。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "ListObjectsInBucket",
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::{{amzn-s3-demo-bucket}}"
      ]
    },
    {
      "Sid": "AllObjectActions",
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject"
      ],
      "Resource": [
        "arn:aws:s3:::{{amzn-s3-demo-bucket}}/*"
      ]
    }
  ]
}
```

------

Neptune DB クラスターで IAM 認証が有効になっている場合、次のポリシーも含める必要があります。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "VisualEditor0",
      "Effect": "Allow",
      "Action": "neptune-db:*",
      "Resource": "arn:aws:neptune-db:{{us-east-1}}:{{111122223333}}:{{cluster-resource-id}}/*"
    }
  ]
}
```

------

ポリシーをアタッチする信頼ドキュメントとして IAM ロールを作成します。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Service": "dms.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    },
    {
      "Sid": "neptune",
      "Effect": "Allow",
      "Principal": {
        "Service": "rds.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
```

------

ポリシーをロールにアタッチした後、ロールを Neptune DB クラスターにアタッチします。これにより、 AWS DMS はロードされるデータをステージングするために バケットを使用できます。

## Neptune VPC で Amazon S3 エンドポイントを作成する
<a name="dms-neptune-s3-endpoint"></a>

ここでは、Neptune クラスターが配置されている VPC に、中間 Amazon S3 バケットの VPC ゲートウェイエンドポイントを作成します。 AWS マネジメントコンソール または を使用して AWS CLI これを行うことができます。詳細については、[「ゲートウェイエンドポイントの作成](https://docs.aws.amazon.com/vpc/latest/userguide/vpce-gateway.html#create-gateway-endpoint)」を参照してください。

## Neptune の AWS DMS ターゲットエンドポイントを作成する
<a name="dms-neptune-target-endpoint"></a>

ターゲット Neptune DB クラスターの AWS DMS エンドポイントを作成します。 AWS DMS [CreateEndpoint](https://docs.aws.amazon.com/dms/latest/APIReference/API_CreateEndpoint.html) API は、次のような `NeptuneSettings`パラメータで使用できます。

```
aws dms create-endpoint \
    --endpoint-identifier {{(target endpoint identifier)}} \
    --endpoint-type target \
    --engine-name neptune \
    --server-name {{(name of the server)}} \
    --port {{(port number)}} \
    --neptune-settings '{ \
      "ServiceAccessRoleArn": "{{(ARN of the service access role)}}", \
      "S3BucketName": "{{(name of S3 bucket to use for staging files when migrating)}}", \
      "S3BucketFolder": "{{(name of the folder to use in that S3 bucket)}}", \
      "ErrorRetryDuration": {{(number of milliseconds to wait between bulk-load retries)}}, \
      "MaxRetryCount": {{(the maximum number of times to retry a failing bulk-load job)}}, \
      "MaxFileSize": {{(maximum file size, in bytes, of the staging files written to S3)}}, \
      "IamAuthEnabled": {{(set to true if IAM authentication is enabled on the Neptune cluster)}} }'
```

`NeptuneSettings` パラメータで AWS DMS `CreateEndpoint` API に渡される JSON オブジェクトには、次のフィールドがあります。

****
+ **`ServiceAccessRoleArn`**   –   *(必須)* Neptune へのデータの移行をステージングするために使用される S3 バケットへのきめ細かなアクセスを許可する IIAM ロールの ARN。IAM 認可が有効になっている場合、このロールには Neptune DB クラスターにアクセスするアクセス許可も必要です。
+ **`S3BucketName`** – *(必須)*フルロード移行の場合、レプリケーションインスタンスはすべての RDS データを CSV、クワッドファイルに変換し、S3 のこのステージングバケットにアップロードし、それらを Neptune に一括ロードします。
+ **`S3BucketFolder`** – *(必須)* S3 ステージングバケットで使用するフォルダー。
+ **`ErrorRetryDuration`** – *(オプション)* Neptune リクエストが失敗してから再試行リクエストを行うまでに待機するミリ秒数。デフォルトは 250 です。
+ **`MaxRetryCount`**   –   *(オプション)* 再試行可能な失敗後に AWS DMS 行う再試行リクエストの最大数。デフォルトは 5 です。
+ **`MaxFileSize`** – *(オプション)* 移行中に S3 に保存された各ステージングファイルの最大サイズ (バイト単位)。デフォルトは 1,048,576 KB (1 GB) です。
+ **`IsIAMAuthEnabled`** – *(オプション)* IAM 認証が Neptune DB クラスターで有効になっている場合 `true` に、そうでない場合 `false` に設定します。デフォルトは `false` です。

## 新しいエンドポイントへの接続をテストする
<a name="dms-neptune-test-endpoints"></a>

これらの新しいエンドポイントへの接続は、 AWS DMS [TestConnection](https://docs.aws.amazon.com/dms/latest/APIReference/API_TestConnection.html) API を使用して次のようにテストできます。

```
aws dms test-connection \
    --replication-instance-arn {{(the ARN of the replication instance)}} \
    --endpoint-arn {{(the ARN of the endpoint you are testing)}}
```

## AWS DMS レプリケーションタスクを作成する
<a name="dms-neptune-replication-task"></a>

前の手順を正常に完了したら、ソースデータストアから Neptune にデータを移行するためのレプリケーションタスクを AWS DMS [CreateReplicationTask](https://docs.aws.amazon.com/dms/latest/APIReference/API_CreateReplicationTask.html.html) API を使用して作成します。

```
aws dms create-replication-task \
    --replication-task-identifier {{(name for the replication task)}} \
    --source-endpoint-arn {{(ARN of the source endpoint)}} \
    --target-endpoint-arn {{(ARN of the target endpoint)}} \
    --replication-instance-arn {{(ARN of the replication instance)}} \
    --migration-type full-load \
    --table-mappings {{(table-mapping JSON object or URI like 'file:///tmp/table-mappings,json')}} \
    --task-data {{(a GraphMappingConfig object or URI like 'file:///tmp/graph-mapping-config.json')}}
```

`TaskData` パラメータは、コピーされたデータを Neptune に保存する方法を指定する [GraphMappingConfig](dms-neptune-graph-mapping.md) を提供します。

## AWS DMS レプリケーションタスクを開始する
<a name="dms-neptune-start-task"></a>

ここでは、レプリケーションタスクを開始できます。

```
aws dms start-replication-task
    --replication-task-arn {{(ARN of the replication task started in the previous step)}}
    --start-replication-task-type start-replication
```