在源数据库和目标数据库之间建立VPC连接。
在源数据库和目标数据库上创建IAM角色,具有以下策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Resource": "*",
"Action": "dms:*",
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16"
]
}
}
}
]
}
并授予AWS DMS Endpoint访问角色的权限:arn:aws:iam::*:role/aws-service-role/dms.amazonaws.com
{
"EndpointIdentifier": "mysql-source",
"EndpointType": "source",
"EngineName": "mysql",
"Username": "user",
"Password": "password",
"ServerName": "source.server.com",
"Port": 3306,
"DatabaseName": "sourceDB"
}
{
"EndpointIdentifier": "mysql-target",
"EndpointType": "target",
"EngineName": "mysql",
"Username": "user",
"Password": "password",
"ServerName": "target.server.com",
"Port": 3306,
"DatabaseName": "targetDB"
}
创建任务,指定源和目标端点。
在DMS任务中创建迁移规则。对于此示例,我们将使用以下JSON:
{
"rule-type": "selection",
"rule-id": "1",
"rule-name": "1",
"object-locator": {
"schema-name": "%",
"table-name": "%"
},
"rule-action": "include"
}
此规则会将所有表包含在迁移中。
{
"TargetMetadata": {
"TargetSchema": "encryptedDB"
},
"FullLoadSettings": {
"TargetTablePrepMode": "TRUNCATE_BEFORE_LOAD"
},
"Logging": {
"EnableLogging": true,
"LogComponents": [
{
"Id": "SOURCE_UNLOAD"
},
{
"Id": "LOAD"
},
{