选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

AWS DMS 使用示例 AWS CLI

聚焦模式

本页内容

AWS DMS 使用示例 AWS CLI - AWS Command Line Interface

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

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

以下代码示例向您展示了如何使用with来执行操作和实现常见场景 AWS DMS。 AWS Command Line Interface

操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景的上下文查看操作。

每个示例都包含一个指向完整源代码的链接,您可以在其中找到有关如何在上下文中设置和运行代码的说明。

主题

操作

以下代码示例显示了如何使用add-tags-to-resource

AWS CLI

为资源添加标签

以下add-tags-to-resource示例为复制实例添加标签。

aws dms add-tags-to-resource \ --resource-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --tags Key=Environment,Value=PROD Key=Project,Value=dbMigration

此命令不生成任何输出。

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的标记资源

以下代码示例显示了如何使用add-tags-to-resource

AWS CLI

为资源添加标签

以下add-tags-to-resource示例为复制实例添加标签。

aws dms add-tags-to-resource \ --resource-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --tags Key=Environment,Value=PROD Key=Project,Value=dbMigration

此命令不生成任何输出。

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的标记资源

以下代码示例显示了如何使用create-endpoint

AWS CLI

创建终端节点

以下create-endpoint示例为 Amazon S3 源创建了一个终端节点。

aws dms create-endpoint \ --endpoint-type source \ --engine-name s3 \ --endpoint-identifier src-endpoint \ --s3-settings file://s3-settings.json

s3-settings.json 的内容:

{ "BucketName":"my-corp-data", "BucketFolder":"sourcedata", "ServiceAccessRoleArn":"arn:aws:iam::123456789012:role/my-s3-access-role" }

输出:

{ "Endpoint": { "EndpointIdentifier": "src-endpoint", "EndpointType": "SOURCE", "EngineName": "s3", "EngineDisplayName": "Amazon S3", "ExtraConnectionAttributes": "bucketFolder=sourcedata;bucketName=my-corp-data;compressionType=NONE;csvDelimiter=,;csvRowDelimiter=\\n;", "Status": "active", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:GUVAFG34EECUOJ6QVZ56DAHT3U", "SslMode": "none", "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "S3Settings": { "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "CsvRowDelimiter": "\\n", "CsvDelimiter": ",", "BucketFolder": "sourcedata", "BucketName": "my-corp-data", "CompressionType": "NONE", "EnableStatistics": true } } }

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的使用 AWS DMS端点

以下代码示例显示了如何使用create-endpoint

AWS CLI

创建终端节点

以下create-endpoint示例为 Amazon S3 源创建了一个终端节点。

aws dms create-endpoint \ --endpoint-type source \ --engine-name s3 \ --endpoint-identifier src-endpoint \ --s3-settings file://s3-settings.json

s3-settings.json 的内容:

{ "BucketName":"my-corp-data", "BucketFolder":"sourcedata", "ServiceAccessRoleArn":"arn:aws:iam::123456789012:role/my-s3-access-role" }

输出:

{ "Endpoint": { "EndpointIdentifier": "src-endpoint", "EndpointType": "SOURCE", "EngineName": "s3", "EngineDisplayName": "Amazon S3", "ExtraConnectionAttributes": "bucketFolder=sourcedata;bucketName=my-corp-data;compressionType=NONE;csvDelimiter=,;csvRowDelimiter=\\n;", "Status": "active", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:GUVAFG34EECUOJ6QVZ56DAHT3U", "SslMode": "none", "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "S3Settings": { "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "CsvRowDelimiter": "\\n", "CsvDelimiter": ",", "BucketFolder": "sourcedata", "BucketName": "my-corp-data", "CompressionType": "NONE", "EnableStatistics": true } } }

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的使用 AWS DMS端点

以下代码示例显示了如何使用create-event-subscription

AWS CLI

列出活动订阅

以下create-event-subscription示例创建了对 Amazon SNS 主题的事件订阅 (my-sns-topic)。

aws dms create-event-subscription \ --subscription-name my-dms-events \ --sns-topic-arn arn:aws:sns:us-east-1:123456789012:my-sns-topic

输出:

{ "EventSubscription": { "CustomerAwsId": "123456789012", "CustSubscriptionId": "my-dms-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:my-sns-topic", "Status": "creating", "SubscriptionCreationTime": "2020-05-21 21:58:38.598", "Enabled": true } }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用create-event-subscription

AWS CLI

列出活动订阅

以下create-event-subscription示例创建了对 Amazon SNS 主题的事件订阅 (my-sns-topic)。

aws dms create-event-subscription \ --subscription-name my-dms-events \ --sns-topic-arn arn:aws:sns:us-east-1:123456789012:my-sns-topic

输出:

{ "EventSubscription": { "CustomerAwsId": "123456789012", "CustSubscriptionId": "my-dms-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:my-sns-topic", "Status": "creating", "SubscriptionCreationTime": "2020-05-21 21:58:38.598", "Enabled": true } }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用create-replication-instance

AWS CLI

创建复制实例

以下create-replication-instance示例创建了一个复制实例。

aws dms create-replication-instance \ --replication-instance-identifier my-repl-instance \ --replication-instance-class dms.t2.micro \ --allocated-storage 5

输出:

{ "ReplicationInstance": { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "creating", "AllocatedStorage": 5, "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-f839b688", "Status": "active" } ], "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "default", "ReplicationSubnetGroupDescription": "default", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-42599426", "SubnetAvailabilityZone": { "Name": "us-east-1d" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-6746046b", "SubnetAvailabilityZone": { "Name": "us-east-1f" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-cbfff283", "SubnetAvailabilityZone": { "Name": "us-east-1b" }, "SubnetStatus": "Active" } ] }, "PreferredMaintenanceWindow": "sat:12:35-sat:13:05", "PendingModifiedValues": {}, "MultiAZ": false, "EngineVersion": "3.3.2", "AutoMinorVersionUpgrade": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/f7bc0f8e-1a3a-4ace-9faa-e8494fa3921a", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:ZK2VQBUWFDBAWHIXHAYG5G2PKY", "PubliclyAccessible": true } }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用create-replication-instance

AWS CLI

创建复制实例

以下create-replication-instance示例创建了一个复制实例。

aws dms create-replication-instance \ --replication-instance-identifier my-repl-instance \ --replication-instance-class dms.t2.micro \ --allocated-storage 5

输出:

{ "ReplicationInstance": { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "creating", "AllocatedStorage": 5, "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-f839b688", "Status": "active" } ], "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "default", "ReplicationSubnetGroupDescription": "default", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-42599426", "SubnetAvailabilityZone": { "Name": "us-east-1d" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-6746046b", "SubnetAvailabilityZone": { "Name": "us-east-1f" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-cbfff283", "SubnetAvailabilityZone": { "Name": "us-east-1b" }, "SubnetStatus": "Active" } ] }, "PreferredMaintenanceWindow": "sat:12:35-sat:13:05", "PendingModifiedValues": {}, "MultiAZ": false, "EngineVersion": "3.3.2", "AutoMinorVersionUpgrade": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/f7bc0f8e-1a3a-4ace-9faa-e8494fa3921a", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:ZK2VQBUWFDBAWHIXHAYG5G2PKY", "PubliclyAccessible": true } }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用create-replication-subnet-group

AWS CLI

创建子网组

以下create-replication-subnet-group示例创建了一个由 3 个子网组成的组。

aws dms create-replication-subnet-group \ --replication-subnet-group-identifier my-subnet-group \ --replication-subnet-group-description "my subnet group" \ --subnet-ids subnet-da327bf6 subnet-bac383e0 subnet-d7c825e8

输出:

{ "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "my-subnet-group", "ReplicationSubnetGroupDescription": "my subnet group", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" } ] } }

有关更多信息,请参阅 Dat AWS abase Migration Service 用户指南中的为复制实例设置网络

以下代码示例显示了如何使用create-replication-subnet-group

AWS CLI

创建子网组

以下create-replication-subnet-group示例创建了一个由 3 个子网组成的组。

aws dms create-replication-subnet-group \ --replication-subnet-group-identifier my-subnet-group \ --replication-subnet-group-description "my subnet group" \ --subnet-ids subnet-da327bf6 subnet-bac383e0 subnet-d7c825e8

输出:

{ "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "my-subnet-group", "ReplicationSubnetGroupDescription": "my subnet group", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" } ] } }

有关更多信息,请参阅 Dat AWS abase Migration Service 用户指南中的为复制实例设置网络

以下代码示例显示了如何使用create-replication-task

AWS CLI

创建复制任务

以下create-replication-task示例创建了一个复制任务。

aws dms create-replication-task \ --replication-task-identifier movedata \ --source-endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA \ --target-endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U \ --replication-instance-arn $RI_ARN \ --migration-type full-load \ --table-mappings file://table-mappings.json

table-mappings.json 的内容:

{ "rules": [ { "rule-type": "selection", "rule-id": "1", "rule-name": "1", "object-locator": { "schema-name": "prodrep", "table-name": "%" }, "rule-action": "include", "filters": [] } ] }

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted... , "ReplicationTaskSettings": ...output omitted... , "Status": "creating", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用create-replication-task

AWS CLI

创建复制任务

以下create-replication-task示例创建了一个复制任务。

aws dms create-replication-task \ --replication-task-identifier movedata \ --source-endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA \ --target-endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U \ --replication-instance-arn $RI_ARN \ --migration-type full-load \ --table-mappings file://table-mappings.json

table-mappings.json 的内容:

{ "rules": [ { "rule-type": "selection", "rule-id": "1", "rule-name": "1", "object-locator": { "schema-name": "prodrep", "table-name": "%" }, "rule-action": "include", "filters": [] } ] }

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted... , "ReplicationTaskSettings": ...output omitted... , "Status": "creating", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用delete-connection

AWS CLI

删除连接

以下delete-connection示例取消终端节点与复制实例的关联。

aws dms delete-connection \ --endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE

输出:

{ "Connection": { "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "Status": "deleting", "EndpointIdentifier": "src-database-1", "ReplicationInstanceIdentifier": "my-repl-instance" } }

有关更多信息,请参阅《数据库AWS 迁移服务用户指南》https://docs.aws.amazon.com/dms/latest/userguide/CHAP中的 _endpoints.creat ing.html。

以下代码示例显示了如何使用delete-connection

AWS CLI

删除连接

以下delete-connection示例取消终端节点与复制实例的关联。

aws dms delete-connection \ --endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE

输出:

{ "Connection": { "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "Status": "deleting", "EndpointIdentifier": "src-database-1", "ReplicationInstanceIdentifier": "my-repl-instance" } }

有关更多信息,请参阅《数据库AWS 迁移服务用户指南》https://docs.aws.amazon.com/dms/latest/userguide/CHAP中的 _endpoints.creat ing.html。

以下代码示例显示了如何使用delete-endpoint

AWS CLI

删除终端节点

以下delete-endpoint示例删除终端节点。

aws dms delete-endpoint \ --endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:OUJJVXO4XZ4CYTSEG5XGMN2R3Y

输出:

{ "Endpoint": { "EndpointIdentifier": "src-endpoint", "EndpointType": "SOURCE", "EngineName": "s3", "EngineDisplayName": "Amazon S3", "ExtraConnectionAttributes": "bucketFolder=sourcedata;bucketName=my-corp-data;compressionType=NONE;csvDelimiter=,;csvRowDelimiter=\\n;", "Status": "deleting", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:OUJJVXO4XZ4CYTSEG5XGMN2R3Y", "SslMode": "none", "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "S3Settings": { "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "CsvRowDelimiter": "\\n", "CsvDelimiter": ",", "BucketFolder": "sourcedata", "BucketName": "my-corp-data", "CompressionType": "NONE", "EnableStatistics": true } } }

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的使用 AWS DMS端点

以下代码示例显示了如何使用delete-endpoint

AWS CLI

删除终端节点

以下delete-endpoint示例删除终端节点。

aws dms delete-endpoint \ --endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:OUJJVXO4XZ4CYTSEG5XGMN2R3Y

输出:

{ "Endpoint": { "EndpointIdentifier": "src-endpoint", "EndpointType": "SOURCE", "EngineName": "s3", "EngineDisplayName": "Amazon S3", "ExtraConnectionAttributes": "bucketFolder=sourcedata;bucketName=my-corp-data;compressionType=NONE;csvDelimiter=,;csvRowDelimiter=\\n;", "Status": "deleting", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:OUJJVXO4XZ4CYTSEG5XGMN2R3Y", "SslMode": "none", "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "S3Settings": { "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "CsvRowDelimiter": "\\n", "CsvDelimiter": ",", "BucketFolder": "sourcedata", "BucketName": "my-corp-data", "CompressionType": "NONE", "EnableStatistics": true } } }

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的使用 AWS DMS端点

以下代码示例显示了如何使用delete-event-subscription

AWS CLI

删除活动订阅

以下delete-event-subscription示例删除了对 Amazon SNS 主题的订阅。

aws dms delete-event-subscription \ --subscription-name "my-dms-events"

输出:

{ "EventSubscription": { "CustomerAwsId": "123456789012", "CustSubscriptionId": "my-dms-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:my-sns-topic", "Status": "deleting", "SubscriptionCreationTime": "2020-05-21 21:58:38.598", "Enabled": true } }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用delete-event-subscription

AWS CLI

删除活动订阅

以下delete-event-subscription示例删除了对 Amazon SNS 主题的订阅。

aws dms delete-event-subscription \ --subscription-name "my-dms-events"

输出:

{ "EventSubscription": { "CustomerAwsId": "123456789012", "CustSubscriptionId": "my-dms-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:my-sns-topic", "Status": "deleting", "SubscriptionCreationTime": "2020-05-21 21:58:38.598", "Enabled": true } }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用delete-replication-instance

AWS CLI

删除复制实例

以下 delete-replication-instance 示例删除复制实例。

aws dms delete-replication-instance \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE

输出:

{ "ReplicationInstance": { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "deleting", "AllocatedStorage": 5, "InstanceCreateTime": 1590011235.952, "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-f839b688", "Status": "active" } ], "AvailabilityZone": "us-east-1e", "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "default", "ReplicationSubnetGroupDescription": "default", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-42599426", "SubnetAvailabilityZone": { "Name": "us-east-1d" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-6746046b", "SubnetAvailabilityZone": { "Name": "us-east-1f" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-cbfff283", "SubnetAvailabilityZone": { "Name": "us-east-1b" }, "SubnetStatus": "Active" } ] }, "PreferredMaintenanceWindow": "wed:11:42-wed:12:12", "PendingModifiedValues": {}, "MultiAZ": true, "EngineVersion": "3.3.2", "AutoMinorVersionUpgrade": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/f7bc0f8e-1a3a-4ace-9faa-e8494fa3921a", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "ReplicationInstancePublicIpAddress": "54.225.120.92", "ReplicationInstancePrivateIpAddress": "172.31.30.121", "ReplicationInstancePublicIpAddresses": [ "54.225.120.92", "3.230.18.248" ], "ReplicationInstancePrivateIpAddresses": [ "172.31.30.121", "172.31.75.90" ], "PubliclyAccessible": true, "SecondaryAvailabilityZone": "us-east-1b" } }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用delete-replication-instance

AWS CLI

删除复制实例

以下 delete-replication-instance 示例删除复制实例。

aws dms delete-replication-instance \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE

输出:

{ "ReplicationInstance": { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "deleting", "AllocatedStorage": 5, "InstanceCreateTime": 1590011235.952, "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-f839b688", "Status": "active" } ], "AvailabilityZone": "us-east-1e", "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "default", "ReplicationSubnetGroupDescription": "default", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-42599426", "SubnetAvailabilityZone": { "Name": "us-east-1d" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-6746046b", "SubnetAvailabilityZone": { "Name": "us-east-1f" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-cbfff283", "SubnetAvailabilityZone": { "Name": "us-east-1b" }, "SubnetStatus": "Active" } ] }, "PreferredMaintenanceWindow": "wed:11:42-wed:12:12", "PendingModifiedValues": {}, "MultiAZ": true, "EngineVersion": "3.3.2", "AutoMinorVersionUpgrade": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/f7bc0f8e-1a3a-4ace-9faa-e8494fa3921a", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "ReplicationInstancePublicIpAddress": "54.225.120.92", "ReplicationInstancePrivateIpAddress": "172.31.30.121", "ReplicationInstancePublicIpAddresses": [ "54.225.120.92", "3.230.18.248" ], "ReplicationInstancePrivateIpAddresses": [ "172.31.30.121", "172.31.75.90" ], "PubliclyAccessible": true, "SecondaryAvailabilityZone": "us-east-1b" } }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用delete-replication-subnet-group

AWS CLI

删除子网组

以下delete-replication-subnet-group示例删除子网组。

aws dms delete-replication-subnet-group \ --replication-subnet-group-identifier my-subnet-group

输出:

(none)

有关更多信息,请参阅 Dat AWS abase Migration Service 用户指南中的为复制实例设置网络

以下代码示例显示了如何使用delete-replication-subnet-group

AWS CLI

删除子网组

以下delete-replication-subnet-group示例删除子网组。

aws dms delete-replication-subnet-group \ --replication-subnet-group-identifier my-subnet-group

输出:

(none)

有关更多信息,请参阅 Dat AWS abase Migration Service 用户指南中的为复制实例设置网络

以下代码示例显示了如何使用delete-replication-task

AWS CLI

删除复制任务

以下delete-replication-task示例删除了复制任务。

aws dms delete-replication-task \ --replication-task-arn arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted..., "ReplicationTaskSettings": ...output omitted..., "Status": "deleting", "StopReason": "Stop Reason FULL_LOAD_ONLY_FINISHED", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590789988.677, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用delete-replication-task

AWS CLI

删除复制任务

以下delete-replication-task示例删除了复制任务。

aws dms delete-replication-task \ --replication-task-arn arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted..., "ReplicationTaskSettings": ...output omitted..., "Status": "deleting", "StopReason": "Stop Reason FULL_LOAD_ONLY_FINISHED", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590789988.677, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用describe-account-attributes

AWS CLI

描述账户属性

以下describe-account-attributes示例列出了您的 AWS 账户的属性。

aws dms describe-account-attributes

输出:

{ "AccountQuotas": [ { "AccountQuotaName": "ReplicationInstances", "Used": 1, "Max": 20 }, { "AccountQuotaName": "AllocatedStorage", "Used": 5, "Max": 10000 }, ...remaining output omitted... ], "UniqueAccountIdentifier": "cqahfbfy5xee" }

以下代码示例显示了如何使用describe-account-attributes

AWS CLI

描述账户属性

以下describe-account-attributes示例列出了您的 AWS 账户的属性。

aws dms describe-account-attributes

输出:

{ "AccountQuotas": [ { "AccountQuotaName": "ReplicationInstances", "Used": 1, "Max": 20 }, { "AccountQuotaName": "AllocatedStorage", "Used": 5, "Max": 10000 }, ...remaining output omitted... ], "UniqueAccountIdentifier": "cqahfbfy5xee" }

以下代码示例显示了如何使用describe-certificates

AWS CLI

列出可用证书

以下describe-certificates示例列出了您 AWS 账户中的可用证书。

aws dms describe-certificates

输出:

{ "Certificates": [ { "CertificateIdentifier": "my-cert", "CertificateCreationDate": 1543259542.506, "CertificatePem": "-----BEGIN CERTIFICATE-----\nMIID9DCCAtygAwIBAgIBQjANBgkqhkiG9w0BAQ ...U" ... remaining output omittted ... } ] }

有关更多信息,请参阅 AWS Database Migration Service 用户指南SSL中的使用

以下代码示例显示了如何使用describe-certificates

AWS CLI

列出可用证书

以下describe-certificates示例列出了您 AWS 账户中的可用证书。

aws dms describe-certificates

输出:

{ "Certificates": [ { "CertificateIdentifier": "my-cert", "CertificateCreationDate": 1543259542.506, "CertificatePem": "-----BEGIN CERTIFICATE-----\nMIID9DCCAtygAwIBAgIBQjANBgkqhkiG9w0BAQ ...U" ... remaining output omittted ... } ] }

有关更多信息,请参阅 AWS Database Migration Service 用户指南SSL中的使用

以下代码示例显示了如何使用describe-connections

AWS CLI

描述连接

以下describe-connections示例列出了您在复制实例和终端节点之间测试的连接。

aws dms describe-connections

输出:

{ "Connections": [ { "Status": "successful", "ReplicationInstanceIdentifier": "test", "EndpointArn": "arn:aws:dms:us-east-arn:aws:dms:us-east-1:123456789012:endpoint:ZW5UAN6P4E77EC7YWHK4RZZ3BE", "EndpointIdentifier": "testsrc1", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:6UTDJGBOUS3VI3SUWA66XFJCJQ" } ] }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的创建源端点和目标端点

以下代码示例显示了如何使用describe-connections

AWS CLI

描述连接

以下describe-connections示例列出了您在复制实例和终端节点之间测试的连接。

aws dms describe-connections

输出:

{ "Connections": [ { "Status": "successful", "ReplicationInstanceIdentifier": "test", "EndpointArn": "arn:aws:dms:us-east-arn:aws:dms:us-east-1:123456789012:endpoint:ZW5UAN6P4E77EC7YWHK4RZZ3BE", "EndpointIdentifier": "testsrc1", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:6UTDJGBOUS3VI3SUWA66XFJCJQ" } ] }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的创建源端点和目标端点

以下代码示例显示了如何使用describe-endpoint-types

AWS CLI

列出可用的端点类型

以下describe-endpoint-types示例列出了可用的我的SQL终端节点类型。

aws dms describe-endpoint-types \ --filters "Name=engine-name,Values=mysql"

输出:

{ "SupportedEndpointTypes": [ { "EngineName": "mysql", "SupportsCDC": true, "EndpointType": "source", "EngineDisplayName": "MySQL" }, { "EngineName": "mysql", "SupportsCDC": true, "EndpointType": "target", "EngineDisplayName": "MySQL" } ] }

有关更多信息,请参阅《数据库迁移服务用户指南》中的使用 AWS DMS端点 < https://docs.aws.amazon.com/dms/ latest/userguide/CHAP _endpoints.html>`__。AWS

以下代码示例显示了如何使用describe-endpoint-types

AWS CLI

列出可用的端点类型

以下describe-endpoint-types示例列出了可用的我的SQL终端节点类型。

aws dms describe-endpoint-types \ --filters "Name=engine-name,Values=mysql"

输出:

{ "SupportedEndpointTypes": [ { "EngineName": "mysql", "SupportsCDC": true, "EndpointType": "source", "EngineDisplayName": "MySQL" }, { "EngineName": "mysql", "SupportsCDC": true, "EndpointType": "target", "EngineDisplayName": "MySQL" } ] }

有关更多信息,请参阅《数据库迁移服务用户指南》中的使用 AWS DMS端点 < https://docs.aws.amazon.com/dms/ latest/userguide/CHAP _endpoints.html>`__。AWS

以下代码示例显示了如何使用describe-endpoints

AWS CLI

描述端点

以下describe-endpoints示例列出了您 AWS 账户中的终端节点。

aws dms describe-endpoints

输出:

{ "Endpoints": [ { "Username": "dms", "Status": "active", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:SF2WOFLWYWKVEOHID2EKLP3SJI", "ServerName": "ec2-52-32-48-61.us-west-2.compute.amazonaws.com", "EndpointType": "SOURCE", "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/94d5c4e7-4e4c-44be-b58a-c8da7adf57cd", "DatabaseName": "test", "EngineName": "mysql", "EndpointIdentifier": "pri100", "Port": 8193 }, { "Username": "admin", "Status": "active", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:TJJZCIH3CJ24TJRU4VC32WEWFR", "ServerName": "test.example.com", "EndpointType": "SOURCE", "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/2431021b-1cf2-a2d4-77b2-59a9e4bce323", "DatabaseName": "EMPL", "EngineName": "oracle", "EndpointIdentifier": "test", "Port": 1521 } ] }

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的使用 AWS DMS端点

以下代码示例显示了如何使用describe-endpoints

AWS CLI

描述端点

以下describe-endpoints示例列出了您 AWS 账户中的终端节点。

aws dms describe-endpoints

输出:

{ "Endpoints": [ { "Username": "dms", "Status": "active", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:SF2WOFLWYWKVEOHID2EKLP3SJI", "ServerName": "ec2-52-32-48-61.us-west-2.compute.amazonaws.com", "EndpointType": "SOURCE", "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/94d5c4e7-4e4c-44be-b58a-c8da7adf57cd", "DatabaseName": "test", "EngineName": "mysql", "EndpointIdentifier": "pri100", "Port": 8193 }, { "Username": "admin", "Status": "active", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:TJJZCIH3CJ24TJRU4VC32WEWFR", "ServerName": "test.example.com", "EndpointType": "SOURCE", "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/2431021b-1cf2-a2d4-77b2-59a9e4bce323", "DatabaseName": "EMPL", "EngineName": "oracle", "EndpointIdentifier": "test", "Port": 1521 } ] }

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的使用 AWS DMS端点

以下代码示例显示了如何使用describe-event-categories

AWS CLI

描述事件类别

以下describe-event-categories示例列出了可用的事件类别。

aws dms describe-event-categories

输出:

{ "EventCategoryGroupList": [ { "SourceType": "replication-instance", "EventCategories": [ "low storage", "configuration change", "maintenance", "deletion", "creation", "failover", "failure" ] }, { "SourceType": "replication-task", "EventCategories": [ "configuration change", "state change", "deletion", "creation", "failure" ] } ] }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用describe-event-categories

AWS CLI

描述事件类别

以下describe-event-categories示例列出了可用的事件类别。

aws dms describe-event-categories

输出:

{ "EventCategoryGroupList": [ { "SourceType": "replication-instance", "EventCategories": [ "low storage", "configuration change", "maintenance", "deletion", "creation", "failover", "failure" ] }, { "SourceType": "replication-task", "EventCategories": [ "configuration change", "state change", "deletion", "creation", "failure" ] } ] }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用describe-event-subscriptions

AWS CLI

描述活动订阅

以下describe-event-subscriptions示例列出了对 Amazon SNS 主题的事件订阅。

aws dms describe-event-subscriptions

输出:

{ "EventSubscriptionsList": [ { "CustomerAwsId": "123456789012", "CustSubscriptionId": "my-dms-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:my-sns-topic", "Status": "deleting", "SubscriptionCreationTime": "2020-05-21 22:28:51.924", "Enabled": true } ] }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用describe-event-subscriptions

AWS CLI

描述活动订阅

以下describe-event-subscriptions示例列出了对 Amazon SNS 主题的事件订阅。

aws dms describe-event-subscriptions

输出:

{ "EventSubscriptionsList": [ { "CustomerAwsId": "123456789012", "CustSubscriptionId": "my-dms-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:my-sns-topic", "Status": "deleting", "SubscriptionCreationTime": "2020-05-21 22:28:51.924", "Enabled": true } ] }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用describe-events

AWS CLI

列出DMS事件

以下describe-events示例列出了源自复制实例的事件。

aws dms describe-events \ --source-type "replication-instance"

输出:

{ "Events": [ { "SourceIdentifier": "my-repl-instance", "SourceType": "replication-instance", "Message": "Replication application shutdown", "EventCategories": [], "Date": 1590771645.776 } ] }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用describe-events

AWS CLI

列出DMS事件

以下describe-events示例列出了源自复制实例的事件。

aws dms describe-events \ --source-type "replication-instance"

输出:

{ "Events": [ { "SourceIdentifier": "my-repl-instance", "SourceType": "replication-instance", "Message": "Replication application shutdown", "EventCategories": [], "Date": 1590771645.776 } ] }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用describe-orderable-replication-instances

AWS CLI

描述可订购的复制实例

以下describe-orderable-replication-instances示例列出了您可以订购的复制实例类型。

aws dms describe-orderable-replication-instances

输出:

{ "OrderableReplicationInstances": [ { "EngineVersion": "3.3.2", "ReplicationInstanceClass": "dms.c4.2xlarge", "StorageType": "gp2", "MinAllocatedStorage": 5, "MaxAllocatedStorage": 6144, "DefaultAllocatedStorage": 100, "IncludedAllocatedStorage": 100, "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d", "us-east-1e", "us-east-1f" ] }, { "EngineVersion": "3.3.2", "ReplicationInstanceClass": "dms.c4.4xlarge", "StorageType": "gp2", "MinAllocatedStorage": 5, "MaxAllocatedStorage": 6144, "DefaultAllocatedStorage": 100, "IncludedAllocatedStorage": 100, "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d", "us-east-1e", "us-east-1f" ] }, ...remaining output omitted... }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用describe-orderable-replication-instances

AWS CLI

描述可订购的复制实例

以下describe-orderable-replication-instances示例列出了您可以订购的复制实例类型。

aws dms describe-orderable-replication-instances

输出:

{ "OrderableReplicationInstances": [ { "EngineVersion": "3.3.2", "ReplicationInstanceClass": "dms.c4.2xlarge", "StorageType": "gp2", "MinAllocatedStorage": 5, "MaxAllocatedStorage": 6144, "DefaultAllocatedStorage": 100, "IncludedAllocatedStorage": 100, "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d", "us-east-1e", "us-east-1f" ] }, { "EngineVersion": "3.3.2", "ReplicationInstanceClass": "dms.c4.4xlarge", "StorageType": "gp2", "MinAllocatedStorage": 5, "MaxAllocatedStorage": 6144, "DefaultAllocatedStorage": 100, "IncludedAllocatedStorage": 100, "AvailabilityZones": [ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d", "us-east-1e", "us-east-1f" ] }, ...remaining output omitted... }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用describe-refresh-schemas-status

AWS CLI

列出终端节点的刷新状态

以下describe-refresh-schemas-status示例返回先前刷新请求的状态。

aws dms describe-refresh-schemas-status \ --endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA

输出:

{ "RefreshSchemasStatus": { "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "Status": "successful", "LastRefreshDate": 1590786544.605 } }

以下代码示例显示了如何使用describe-refresh-schemas-status

AWS CLI

列出终端节点的刷新状态

以下describe-refresh-schemas-status示例返回先前刷新请求的状态。

aws dms describe-refresh-schemas-status \ --endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA

输出:

{ "RefreshSchemasStatus": { "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "Status": "successful", "LastRefreshDate": 1590786544.605 } }

以下代码示例显示了如何使用describe-replication-instances

AWS CLI

描述复制实例

以下describe-replication-instances示例列出了您 AWS 账户中的复制实例。

aws dms describe-replication-instances

输出:

{ "ReplicationInstances": [ { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "available", "AllocatedStorage": 5, "InstanceCreateTime": 1590011235.952, "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-f839b688", "Status": "active" } ], "AvailabilityZone": "us-east-1e", "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "default", "ReplicationSubnetGroupDescription": "default", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-42599426", "SubnetAvailabilityZone": { "Name": "us-east-1d" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-6746046b", "SubnetAvailabilityZone": { "Name": "us-east-1f" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-cbfff283", "SubnetAvailabilityZone": { "Name": "us-east-1b" }, "SubnetStatus": "Active" } ] }, "PreferredMaintenanceWindow": "wed:11:42-wed:12:12", "PendingModifiedValues": { "MultiAZ": true }, "MultiAZ": false, "EngineVersion": "3.3.2", "AutoMinorVersionUpgrade": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/f7bc0f8e-1a3a-4ace-9faa-e8494fa3921a", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "ReplicationInstancePublicIpAddress": "3.230.18.248", "ReplicationInstancePrivateIpAddress": "172.31.75.90", "ReplicationInstancePublicIpAddresses": [ "3.230.18.248" ], "ReplicationInstancePrivateIpAddresses": [ "172.31.75.90" ], "PubliclyAccessible": true, "FreeUntil": 1590194829.267 } ] }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用describe-replication-instances

AWS CLI

描述复制实例

以下describe-replication-instances示例列出了您 AWS 账户中的复制实例。

aws dms describe-replication-instances

输出:

{ "ReplicationInstances": [ { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "available", "AllocatedStorage": 5, "InstanceCreateTime": 1590011235.952, "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-f839b688", "Status": "active" } ], "AvailabilityZone": "us-east-1e", "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "default", "ReplicationSubnetGroupDescription": "default", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-42599426", "SubnetAvailabilityZone": { "Name": "us-east-1d" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-6746046b", "SubnetAvailabilityZone": { "Name": "us-east-1f" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-cbfff283", "SubnetAvailabilityZone": { "Name": "us-east-1b" }, "SubnetStatus": "Active" } ] }, "PreferredMaintenanceWindow": "wed:11:42-wed:12:12", "PendingModifiedValues": { "MultiAZ": true }, "MultiAZ": false, "EngineVersion": "3.3.2", "AutoMinorVersionUpgrade": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/f7bc0f8e-1a3a-4ace-9faa-e8494fa3921a", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "ReplicationInstancePublicIpAddress": "3.230.18.248", "ReplicationInstancePrivateIpAddress": "172.31.75.90", "ReplicationInstancePublicIpAddresses": [ "3.230.18.248" ], "ReplicationInstancePrivateIpAddresses": [ "172.31.75.90" ], "PubliclyAccessible": true, "FreeUntil": 1590194829.267 } ] }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用describe-replication-subnet-groups

AWS CLI

显示可用的子网组

以下describe-replication-subnet-groups示例列出了可用的子网组。

aws dms describe-replication-subnet-groups \ --filter "Name=replication-subnet-group-id,Values=my-subnet-group"

输出:

{ "ReplicationSubnetGroups": [ { "ReplicationSubnetGroupIdentifier": "my-subnet-group", "ReplicationSubnetGroupDescription": "my subnet group", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" } ] } ] }

有关更多信息,请参阅 Dat AWS abase Migration Service 用户指南中的为复制实例设置网络

以下代码示例显示了如何使用describe-replication-subnet-groups

AWS CLI

显示可用的子网组

以下describe-replication-subnet-groups示例列出了可用的子网组。

aws dms describe-replication-subnet-groups \ --filter "Name=replication-subnet-group-id,Values=my-subnet-group"

输出:

{ "ReplicationSubnetGroups": [ { "ReplicationSubnetGroupIdentifier": "my-subnet-group", "ReplicationSubnetGroupDescription": "my subnet group", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-d7c825e8", "SubnetAvailabilityZone": { "Name": "us-east-1e" }, "SubnetStatus": "Active" } ] } ] }

有关更多信息,请参阅 Dat AWS abase Migration Service 用户指南中的为复制实例设置网络

以下代码示例显示了如何使用describe-replication-task-assessment-results

AWS CLI

列出复制任务评估的结果

以下describe-replication-task-assessment-results示例列出了先前任务评估的结果。

aws dms describe-replication-task-assessment-results

输出:

{ "ReplicationTaskAssessmentResults": [ { "ReplicationTaskIdentifier": "moveit2", "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII", "ReplicationTaskLastAssessmentDate": 1590790230.0, "AssessmentStatus": "No issues found", "AssessmentResultsFile": "moveit2/2020-05-29-22-10" } ] }

有关更多信息,请参阅《D AWS atabase Migration Service 用户指南》中的创建任务评估报告

以下代码示例显示了如何使用describe-replication-task-assessment-results

AWS CLI

列出复制任务评估的结果

以下describe-replication-task-assessment-results示例列出了先前任务评估的结果。

aws dms describe-replication-task-assessment-results

输出:

{ "ReplicationTaskAssessmentResults": [ { "ReplicationTaskIdentifier": "moveit2", "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII", "ReplicationTaskLastAssessmentDate": 1590790230.0, "AssessmentStatus": "No issues found", "AssessmentResultsFile": "moveit2/2020-05-29-22-10" } ] }

有关更多信息,请参阅《D AWS atabase Migration Service 用户指南》中的创建任务评估报告

以下代码示例显示了如何使用describe-replication-tasks

AWS CLI

描述复制任务

以下describe-replication-tasks示例描述了当前的复制任务。

aws dms describe-replication-tasks

输出:

{ "ReplicationTasks": [ { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted... , "ReplicationTaskSettings": ...output omitted... , "Status": "stopped", "StopReason": "Stop Reason FULL_LOAD_ONLY_FINISHED", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590619805.212, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII", "ReplicationTaskStats": { "FullLoadProgressPercent": 100, "ElapsedTimeMillis": 0, "TablesLoaded": 0, "TablesLoading": 0, "TablesQueued": 0, "TablesErrored": 0, "FreshStartDate": 1590619811.528, "StartDate": 1590619811.528, "StopDate": 1590619842.068 } } ] }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用describe-replication-tasks

AWS CLI

描述复制任务

以下describe-replication-tasks示例描述了当前的复制任务。

aws dms describe-replication-tasks

输出:

{ "ReplicationTasks": [ { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted... , "ReplicationTaskSettings": ...output omitted... , "Status": "stopped", "StopReason": "Stop Reason FULL_LOAD_ONLY_FINISHED", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590619805.212, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII", "ReplicationTaskStats": { "FullLoadProgressPercent": 100, "ElapsedTimeMillis": 0, "TablesLoaded": 0, "TablesLoading": 0, "TablesQueued": 0, "TablesErrored": 0, "FreshStartDate": 1590619811.528, "StartDate": 1590619811.528, "StopDate": 1590619842.068 } } ] }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用describe-schemas

AWS CLI

描述数据库架构

以下describe-schemas示例列出了终端节点上的可用表。

aws dms describe-schemas \ --endpoint-arn "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA"

输出:

{ "Schemas": [ "prodrep" ] }

有关更多信息,请参阅《D AWS atabase Migration Service 用户指南》中的主题标题

以下代码示例显示了如何使用describe-schemas

AWS CLI

描述数据库架构

以下describe-schemas示例列出了终端节点上的可用表。

aws dms describe-schemas \ --endpoint-arn "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA"

输出:

{ "Schemas": [ "prodrep" ] }

有关更多信息,请参阅《D AWS atabase Migration Service 用户指南》中的主题标题

以下代码示例显示了如何使用list-tags-for-resource

AWS CLI

列出资源的标签

以下list-tags-for-resource示例列出了复制实例的标签。

aws dms list-tags-for-resource \ --resource-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE

输出:

{ "TagList": [ { "Key": "Project", "Value": "dbMigration" }, { "Key": "Environment", "Value": "PROD" } ] }

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的标记资源

以下代码示例显示了如何使用list-tags-for-resource

AWS CLI

列出资源的标签

以下list-tags-for-resource示例列出了复制实例的标签。

aws dms list-tags-for-resource \ --resource-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE

输出:

{ "TagList": [ { "Key": "Project", "Value": "dbMigration" }, { "Key": "Environment", "Value": "PROD" } ] }

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的标记资源

以下代码示例显示了如何使用modify-endpoint

AWS CLI

修改终端节点

以下modify-endpoint示例向终端节点添加了额外的连接属性。

aws dms modify-endpoint \ --endpoint-arn "arn:aws:dms:us-east-1:123456789012:endpoint:GUVAFG34EECUOJ6QVZ56DAHT3U" \ --extra-connection-attributes "compressionType=GZIP"

输出:

{ "Endpoint": { "EndpointIdentifier": "src-endpoint", "EndpointType": "SOURCE", "EngineName": "s3", "EngineDisplayName": "Amazon S3", "ExtraConnectionAttributes": "compressionType=GZIP;csvDelimiter=,;csvRowDelimiter=\\n;", "Status": "active", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:GUVAFG34EECUOJ6QVZ56DAHT3U", "SslMode": "none", "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "S3Settings": { "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "CsvRowDelimiter": "\\n", "CsvDelimiter": ",", "BucketFolder": "", "BucketName": "", "CompressionType": "GZIP", "EnableStatistics": true } } }

有关更多信息,请参阅《数据库迁移服务用户指南》中的使用 AWS DMS端点 < https://docs.aws.amazon.com/dms/ latest/userguide/CHAP _endpoints.html>`__。AWS

以下代码示例显示了如何使用modify-endpoint

AWS CLI

修改终端节点

以下modify-endpoint示例向终端节点添加了额外的连接属性。

aws dms modify-endpoint \ --endpoint-arn "arn:aws:dms:us-east-1:123456789012:endpoint:GUVAFG34EECUOJ6QVZ56DAHT3U" \ --extra-connection-attributes "compressionType=GZIP"

输出:

{ "Endpoint": { "EndpointIdentifier": "src-endpoint", "EndpointType": "SOURCE", "EngineName": "s3", "EngineDisplayName": "Amazon S3", "ExtraConnectionAttributes": "compressionType=GZIP;csvDelimiter=,;csvRowDelimiter=\\n;", "Status": "active", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:GUVAFG34EECUOJ6QVZ56DAHT3U", "SslMode": "none", "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "S3Settings": { "ServiceAccessRoleArn": "arn:aws:iam::123456789012:role/my-s3-access-role", "CsvRowDelimiter": "\\n", "CsvDelimiter": ",", "BucketFolder": "", "BucketName": "", "CompressionType": "GZIP", "EnableStatistics": true } } }

有关更多信息,请参阅《数据库迁移服务用户指南》中的使用 AWS DMS端点 < https://docs.aws.amazon.com/dms/ latest/userguide/CHAP _endpoints.html>`__。AWS

以下代码示例显示了如何使用modify-event-subscription

AWS CLI

修改活动订阅

以下modify-event-subscription示例更改了事件订阅的来源类型。

aws dms modify-event-subscription \ --subscription-name "my-dms-events" \ --source-type replication-task

输出:

{ "EventSubscription": { "CustomerAwsId": "123456789012", "CustSubscriptionId": "my-dms-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:my-sns-topic", "Status": "modifying", "SubscriptionCreationTime": "2020-05-29 17:04:40.262", "SourceType": "replication-task", "Enabled": true } }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用modify-event-subscription

AWS CLI

修改活动订阅

以下modify-event-subscription示例更改了事件订阅的来源类型。

aws dms modify-event-subscription \ --subscription-name "my-dms-events" \ --source-type replication-task

输出:

{ "EventSubscription": { "CustomerAwsId": "123456789012", "CustSubscriptionId": "my-dms-events", "SnsTopicArn": "arn:aws:sns:us-east-1:123456789012:my-sns-topic", "Status": "modifying", "SubscriptionCreationTime": "2020-05-29 17:04:40.262", "SourceType": "replication-task", "Enabled": true } }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的处理事件和通知

以下代码示例显示了如何使用modify-replication-instance

AWS CLI

修改复制实例

以下modify-replication-instance示例修改复制实例,使其使用多可用区部署。

aws dms modify-replication-instance \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --multi-az

输出:

{ "ReplicationInstance": { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "available", "AllocatedStorage": 5, "InstanceCreateTime": 1590011235.952, ...output omitted... "PendingModifiedValues": { "MultiAZ": true }, "MultiAZ": false, "EngineVersion": "3.3.2", "AutoMinorVersionUpgrade": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/f7bc0f8e-1a3a-4ace-9faa-e8494fa3921a", ...output omitted... } }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用modify-replication-instance

AWS CLI

修改复制实例

以下modify-replication-instance示例修改复制实例,使其使用多可用区部署。

aws dms modify-replication-instance \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --multi-az

输出:

{ "ReplicationInstance": { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "available", "AllocatedStorage": 5, "InstanceCreateTime": 1590011235.952, ...output omitted... "PendingModifiedValues": { "MultiAZ": true }, "MultiAZ": false, "EngineVersion": "3.3.2", "AutoMinorVersionUpgrade": true, "KmsKeyId": "arn:aws:kms:us-east-1:123456789012:key/f7bc0f8e-1a3a-4ace-9faa-e8494fa3921a", ...output omitted... } }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用modify-replication-subnet-group

AWS CLI

修改子网组

以下modify-replication-subnet-group示例更改了与子网组关联的子网列表。

aws dms modify-replication-subnet-group \ --replication-subnet-group-identifier my-subnet-group \ --subnet-id subnet-da327bf6 subnet-bac383e0

输出:

{ "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "my-subnet-group", "ReplicationSubnetGroupDescription": "my subnet group", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" } ] } }

有关更多信息,请参阅《Dat AWS abase Migration Service 用户指南》中的为复制实例设置网络

以下代码示例显示了如何使用modify-replication-subnet-group

AWS CLI

修改子网组

以下modify-replication-subnet-group示例更改了与子网组关联的子网列表。

aws dms modify-replication-subnet-group \ --replication-subnet-group-identifier my-subnet-group \ --subnet-id subnet-da327bf6 subnet-bac383e0

输出:

{ "ReplicationSubnetGroup": { "ReplicationSubnetGroupIdentifier": "my-subnet-group", "ReplicationSubnetGroupDescription": "my subnet group", "VpcId": "vpc-136a4c6a", "SubnetGroupStatus": "Complete", "Subnets": [ { "SubnetIdentifier": "subnet-da327bf6", "SubnetAvailabilityZone": { "Name": "us-east-1a" }, "SubnetStatus": "Active" }, { "SubnetIdentifier": "subnet-bac383e0", "SubnetAvailabilityZone": { "Name": "us-east-1c" }, "SubnetStatus": "Active" } ] } }

有关更多信息,请参阅《Dat AWS abase Migration Service 用户指南》中的为复制实例设置网络

以下代码示例显示了如何使用modify-replication-task

AWS CLI

修改复制任务

以下modify-replication-task示例更改了任务的表映射。

aws dms modify-replication-task \ --replication-task-arn "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" \ --table-mappings file://table-mappings.json

table-mappings.json 的内容:

{ "rules": [ { "rule-type": "selection", "rule-id": "1", "rule-name": "1", "object-locator": { "schema-name": "prodrep", "table-name": "ACCT_%" }, "rule-action": "include", "filters": [] } ] }

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted..., "ReplicationTaskSettings": ...output omitted..., "Status": "modifying", "StopReason": "Stop Reason FULL_LOAD_ONLY_FINISHED", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590789424.653, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用modify-replication-task

AWS CLI

修改复制任务

以下modify-replication-task示例更改了任务的表映射。

aws dms modify-replication-task \ --replication-task-arn "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" \ --table-mappings file://table-mappings.json

table-mappings.json 的内容:

{ "rules": [ { "rule-type": "selection", "rule-id": "1", "rule-name": "1", "object-locator": { "schema-name": "prodrep", "table-name": "ACCT_%" }, "rule-action": "include", "filters": [] } ] }

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted..., "ReplicationTaskSettings": ...output omitted..., "Status": "modifying", "StopReason": "Stop Reason FULL_LOAD_ONLY_FINISHED", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590789424.653, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用reboot-replication-instance

AWS CLI

重启复制实例

以下 reboot-replication-instance 示例重启复制实例。

aws dms reboot-replication-instance \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE

输出:

{ "ReplicationInstance": { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "rebooting", "AllocatedStorage": 5, "InstanceCreateTime": 1590011235.952, ... output omitted ... } }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用reboot-replication-instance

AWS CLI

重启复制实例

以下 reboot-replication-instance 示例重启复制实例。

aws dms reboot-replication-instance \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE

输出:

{ "ReplicationInstance": { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "rebooting", "AllocatedStorage": 5, "InstanceCreateTime": 1590011235.952, ... output omitted ... } }

有关更多信息,请参阅 Dat AWS abase Migr AWS DMS ation Service 用户指南中的使用复制实例

以下代码示例显示了如何使用refresh-schemas

AWS CLI

刷新数据库架构

以下refresh-schemas示例请求 AWS DMS刷新终端节点上的架构列表。

aws dms refresh-schemas \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --endpoint-arn "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA"

输出:

{ "RefreshSchemasStatus": { "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "Status": "refreshing", "LastRefreshDate": 1590019949.103 } }

以下代码示例显示了如何使用refresh-schemas

AWS CLI

刷新数据库架构

以下refresh-schemas示例请求 AWS DMS刷新终端节点上的架构列表。

aws dms refresh-schemas \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --endpoint-arn "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA"

输出:

{ "RefreshSchemasStatus": { "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "Status": "refreshing", "LastRefreshDate": 1590019949.103 } }

以下代码示例显示了如何使用reload-tables

AWS CLI

刷新终端节点上可用表的列表

以下reload-tables示例重新加载终端节点上的可用表列表。

aws dms reload-tables \ --replication-task-arn "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" \ --tables-to-reload "SchemaName=prodrep,TableName=ACCT_BAL"

输出:

{ "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" }

以下代码示例显示了如何使用reload-tables

AWS CLI

刷新终端节点上可用表的列表

以下reload-tables示例重新加载终端节点上的可用表列表。

aws dms reload-tables \ --replication-task-arn "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" \ --tables-to-reload "SchemaName=prodrep,TableName=ACCT_BAL"

输出:

{ "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" }

以下代码示例显示了如何使用remove-tags-from-resource

AWS CLI

从复制实例中移除标签

以下remove-tags-from-resource示例从复制实例中删除标签。

aws dms remove-tags-from-resource \ --resource-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --tag-keys Environment Project

此命令不生成任何输出。

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的标记资源

以下代码示例显示了如何使用remove-tags-from-resource

AWS CLI

从复制实例中移除标签

以下remove-tags-from-resource示例从复制实例中删除标签。

aws dms remove-tags-from-resource \ --resource-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --tag-keys Environment Project

此命令不生成任何输出。

有关更多信息,请参阅 AWS Database Migration Service 用户指南中的标记资源

以下代码示例显示了如何使用start-replication-task-assessment

AWS CLI

开始任务评估

以下start-replication-task-assessment示例启动复制任务评估。

aws dms start-replication-task-assessment \ --replication-task-arn arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted..., "ReplicationTaskSettings": ...output omitted..., "Status": "testing", "StopReason": "Stop Reason FULL_LOAD_ONLY_FINISHED", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590789988.677, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《D AWS atabase Migration Service 用户指南》中的创建任务评估报告

以下代码示例显示了如何使用start-replication-task-assessment

AWS CLI

开始任务评估

以下start-replication-task-assessment示例启动复制任务评估。

aws dms start-replication-task-assessment \ --replication-task-arn arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted..., "ReplicationTaskSettings": ...output omitted..., "Status": "testing", "StopReason": "Stop Reason FULL_LOAD_ONLY_FINISHED", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590789988.677, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《D AWS atabase Migration Service 用户指南》中的创建任务评估报告

以下代码示例显示了如何使用start-replication-task

AWS CLI

启动复制任务

以下command-name示例列出了您 AWS 账户中可用的微件。

aws dms start-replication-task \ --replication-task-arn arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII \ --start-replication-task-type reload-target

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted... , "ReplicationTaskSettings": ...output omitted... , "Status": "starting", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590619805.212, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用start-replication-task

AWS CLI

启动复制任务

以下command-name示例列出了您 AWS 账户中可用的微件。

aws dms start-replication-task \ --replication-task-arn arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII \ --start-replication-task-type reload-target

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted... , "ReplicationTaskSettings": ...output omitted... , "Status": "starting", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590619805.212, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用stop-replication-task

AWS CLI

停止任务

以下stop-replication-task示例停止任务。

aws dms stop-replication-task \ --replication-task-arn arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted..., "ReplicationTaskSettings": ...output omitted..., "Status": "stopping", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590789424.653, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用stop-replication-task

AWS CLI

停止任务

以下stop-replication-task示例停止任务。

aws dms stop-replication-task \ --replication-task-arn arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII

输出:

{ "ReplicationTask": { "ReplicationTaskIdentifier": "moveit2", "SourceEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "TargetEndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U", "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "MigrationType": "full-load", "TableMappings": ...output omitted..., "ReplicationTaskSettings": ...output omitted..., "Status": "stopping", "ReplicationTaskCreationDate": 1590524772.505, "ReplicationTaskStartDate": 1590789424.653, "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" } }

有关更多信息,请参阅《AWS Database Migration Service 用户指南》中的 AWS DMS处理任务

以下代码示例显示了如何使用test-connection

AWS CLI

测试与端点的连接

以下test-connection示例测试是否可以从复制实例访问终端节点。

aws dms test-connection \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA

输出:

{ "Connection": { "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "Status": "testing", "EndpointIdentifier": "src-database-1", "ReplicationInstanceIdentifier": "my-repl-instance" } }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的创建源端点和目标端点

以下代码示例显示了如何使用test-connection

AWS CLI

测试与端点的连接

以下test-connection示例测试是否可以从复制实例访问终端节点。

aws dms test-connection \ --replication-instance-arn arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE \ --endpoint-arn arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA

输出:

{ "Connection": { "ReplicationInstanceArn": "arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE", "EndpointArn": "arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA", "Status": "testing", "EndpointIdentifier": "src-database-1", "ReplicationInstanceIdentifier": "my-repl-instance" } }

有关更多信息,请参阅 D AWS atabase Migration Service 用户指南中的创建源端点和目标端点

隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。