可以使用带有“replication-instance”和“endpoints”资源的AWS CLI来创建DMS端点配置。通常情况下,这需要启用VPC endpoint网关,并且必须有CIDR允许列表(允许访问源端点)。以下是一个示例命令,用于创建一个远程源端点:
aws dms create-endpoint –endpoint-identifier my-remote-endpoint –endpoint-type source –engine-name mysql –username –password –server-name –port 3306 –ssl-mode none –database-name –extra-connection-attributes '{"jdbcEnabled":true,"Username":"","Password":""}' –endpoint-identifier-vpc SecurityGroupIds=,SubnetIds=
请注意,“–server-name”参数中应提供服务器的完整DNS名称或IP地址。而且,如果源端点在专用VPC中,您需要使用附加的VPC参数与命令一起使用。如果源端点在公共网络中,则不需要VPC参数。
创建完源端点配置后,您可以创建迁移任务并使用源端点来迁移数据。例如:
aws dms create-replication-task –replication-task-identifier my-replication-task –source-endpoint-arn arn:aws:dms:us-east-2:123456789012:endpoint:my-remote-endpoint –target-endpoint-arn arn:aws:dms:us-east-2:123456789012:endpoint:my-target-endpoint – replication-instance-arn arn:aws:dms:us-east-2:123456789012:rep:my-rep-instance –migration-type full-load-and-cdc
这是一个简化样本命令。您应该根据需要调整参数以及实例、端点和任务的ARNs。
注意:使用跨境端点会产生额外费用。这使AWS DMS跨源和目标之间的网络流量和故障转移无縫地进行。添加和启用与VPC相关的选项(如托管终点)将增加AWS的使用费用。