本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
AWS DMS 使用 的範例 AWS CLI
下列程式碼範例示範如何使用 AWS Command Line Interface 搭配 來執行動作和實作常見案例 AWS DMS。
Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會示範如何呼叫個別服務函數,但您可以在其相關案例中查看內容中的動作。
每個範例都包含完整原始程式碼的連結,您可以在其中找到如何在內容中設定和執行程式碼的指示。
主題
動作
下列程式碼範例示範如何使用 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
\ --tagsKey=Environment,Value=PROD
Key=Project,Value=dbMigration
此命令不會產生輸出。
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的標記資源。
-
如需API詳細資訊,請參閱 命令參考 AddTagsToResource
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-endpoint
。
- AWS CLI
-
建立端點
下列
create-endpoint
範例會建立 Amazon S3 來源的端點。aws dms create-endpoint \ --endpoint-type
source
\ --engine-names3
\ --endpoint-identifiersrc-endpoint
\ --s3-settingsfile://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端點。
-
如需API詳細資訊,請參閱 命令參考 CreateEndpoint
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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-arnarn: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 } }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的使用事件和通知。
-
如需API詳細資訊,請參閱 命令參考 CreateEventSubscription
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-replication-instance
。
- AWS CLI
-
建立複寫執行個體
下列
create-replication-instance
範例會建立複寫執行個體。aws dms create-replication-instance \ --replication-instance-identifier
my-repl-instance
\ --replication-instance-classdms.t2.micro
\ --allocated-storage5
輸出:
{ "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 } }
如需詳細資訊,請參閱 Database Migration Service 使用者指南中的使用 AWS DMS複寫執行個體。 AWS
-
如需API詳細資訊,請參閱 命令參考 CreateReplicationInstance
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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-idssubnet-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" } ] } }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的為複寫執行個體設定網路。
-
如需API詳細資訊,請參閱 命令參考 CreateReplicationSubnetGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-replication-task
。
- AWS CLI
-
若要建立複寫任務
下列
create-replication-task
範例會建立複寫任務。aws dms create-replication-task \ --replication-task-identifier
movedata
\ --source-endpoint-arnarn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA
\ --target-endpoint-arnarn:aws:dms:us-east-1:123456789012:endpoint:EOM4SFKCZEYHZBFGAGZT3QEC5U
\ --replication-instance-arn$RI_ARN
\ --migration-typefull-load
\ --table-mappingsfile://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任務。
-
如需API詳細資訊,請參閱 命令參考 CreateReplicationTask
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-connection
。
- AWS CLI
-
若要刪除連線
下列
delete-connection
範例會取消端點與複寫執行個體的關聯。aws dms delete-connection \ --endpoint-arn
arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA
\ --replication-instance-arnarn: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.Creating.html。
-
如需API詳細資訊,請參閱 命令參考 DeleteConnection
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 } } }
如需詳細資訊,請參閱 Database Migration Service 使用者指南中的使用 AWS DMS端點。 AWS
-
如需API詳細資訊,請參閱 命令參考 DeleteEndpoint
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 } }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的使用事件和通知。
-
如需API詳細資訊,請參閱 命令參考 DeleteEventSubscription
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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" } }
如需詳細資訊,請參閱 Database Migration Service 使用者指南中的使用 AWS DMS複寫執行個體。 AWS
-
如需API詳細資訊,請參閱 命令參考 DeleteReplicationInstance
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-replication-subnet-group
。
- AWS CLI
-
若要刪除子網路群組
下列
delete-replication-subnet-group
範例會刪除子網路群組。aws dms delete-replication-subnet-group \ --replication-subnet-group-identifier
my-subnet-group
輸出:
(none)
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的為複寫執行個體設定網路。
-
如需API詳細資訊,請參閱 命令參考 DeleteReplicationSubnetGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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任務。
-
如需API詳細資訊,請參閱 命令參考 DeleteReplicationTask
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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" }
-
如需API詳細資訊,請參閱 命令參考 DescribeAccountAttributes
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 ... } ] }
如需詳細資訊,請參閱 資料庫遷移服務使用者指南中的使用 SSL 。 AWS
-
如需API詳細資訊,請參閱 命令參考 DescribeCertificates
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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" } ] }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的建立來源和目標端點。
-
如需API詳細資訊,請參閱 命令參考 DescribeConnections
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-endpoint-types
。
- AWS CLI
-
列出可用的端點類型
下列
describe-endpoint-types
範例列出可用的 MySQL 端點類型。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 資料庫遷移服務使用者指南中的使用 AWS DMS端點 <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.html>`__。
-
如需API詳細資訊,請參閱 命令參考 DescribeEndpointTypes
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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端點。
-
如需API詳細資訊,請參閱 命令參考 DescribeEndpoints
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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" ] } ] }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的使用事件和通知。
-
如需API詳細資訊,請參閱 命令參考 DescribeEventCategories
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 } ] }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的使用事件和通知。
-
如需API詳細資訊,請參閱 命令參考 DescribeEventSubscriptions
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 } ] }
如需詳細資訊,請參閱 AWS Database Migration Service 使用者指南中的使用事件和通知。
-
如需API詳細資訊,請參閱 命令參考 DescribeEvents
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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... }
如需詳細資訊,請參閱 Database Migration Service 使用者指南中的使用 AWS DMS複寫執行個體。 AWS
-
如需API詳細資訊,請參閱 命令參考 DescribeOrderableReplicationInstances
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 } }
-
如需API詳細資訊,請參閱 命令參考 DescribeRefreshSchemasStatus
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 } ] }
如需詳細資訊,請參閱 Database Migration Service 使用者指南中的使用 AWS DMS複寫執行個體。 AWS
-
如需API詳細資訊,請參閱 命令參考 DescribeReplicationInstances
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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" } ] } ] }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的設定複寫執行個體的網路。
-
如需API詳細資訊,請參閱 命令參考 DescribeReplicationSubnetGroups
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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" } ] }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的建立任務評估報告。
-
如需API詳細資訊,請參閱 命令參考 DescribeReplicationTaskAssessmentResults
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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任務。
-
如需API詳細資訊,請參閱 命令參考 DescribeReplicationTasks
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-schemas
。
- AWS CLI
-
描述資料庫結構描述
下列
describe-schemas
範例列出端點的可用資料表。aws dms describe-schemas \ --endpoint-arn
"arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA"
輸出:
{ "Schemas": [ "prodrep" ] }
如需詳細資訊,請參閱 AWS Database Migration Service 使用者指南 中的此主題標題
。 -
如需API詳細資訊,請參閱 命令參考 DescribeSchemas
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 資料庫遷移服務使用者指南中的標記資源。
-
如需API詳細資訊,請參閱 命令參考 ListTagsForResource
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 資料庫遷移服務使用者指南中的使用 AWS DMS端點 <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.html>`__。
-
如需API詳細資訊,請參閱 命令參考 ModifyEndpoint
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-event-subscription
。
- AWS CLI
-
若要修改事件訂閱
下列
modify-event-subscription
範例會變更事件訂閱的來源類型。aws dms modify-event-subscription \ --subscription-name
"my-dms-events"
\ --source-typereplication-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 } }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的使用事件和通知。
-
如需API詳細資訊,請參閱 命令參考 ModifyEventSubscription
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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... } }
如需詳細資訊,請參閱 Database Migration Service 使用者指南中的使用 AWS DMS複寫執行個體。 AWS
-
如需API詳細資訊,請參閱 命令參考 ModifyReplicationInstance
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 modify-replication-subnet-group
。
- AWS CLI
-
若要修改子網路群組
下列
modify-replication-subnet-group
範例會變更與子網路群組相關聯的子網路清單。aws dms modify-replication-subnet-group \ --replication-subnet-group-identifier
my-subnet-group
\ --subnet-idsubnet-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" } ] } }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的為複寫執行個體設定網路。
-
如需API詳細資訊,請參閱 命令參考 ModifyReplicationSubnetGroup
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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-mappingsfile://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任務。
-
如需API詳細資訊,請參閱 命令參考 ModifyReplicationTask
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 ... } }
如需詳細資訊,請參閱 Database Migration Service 使用者指南中的使用 AWS DMS複寫執行個體。 AWS
-
如需API詳細資訊,請參閱 命令參考 RebootReplicationInstance
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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 } }
-
如需API詳細資訊,請參閱 命令參考 RefreshSchemas
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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" }
-
如需API詳細資訊,請參閱 命令參考 ReloadTables
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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-keysEnvironment
Project
此命令不會產生輸出。
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的標記資源。
-
如需API詳細資訊,請參閱 命令參考 RemoveTagsFromResource
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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" } }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的建立任務評估報告。
-
如需API詳細資訊,請參閱 命令參考 StartReplicationTaskAssessment
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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-typereload-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" } }
如需詳細資訊,請參閱 Database Migration Service 使用者指南中的使用 AWS DMS任務。 AWS
-
如需API詳細資訊,請參閱 命令參考 StartReplicationTask
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 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" } }
如需詳細資訊,請參閱 Database Migration Service 使用者指南中的使用 AWS DMS任務。 AWS
-
如需API詳細資訊,請參閱 命令參考 StopReplicationTask
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 test-connection
。
- AWS CLI
-
測試與端點的連線
下列
test-connection
範例會測試是否可以從複寫執行個體存取端點。aws dms test-connection \ --replication-instance-arn
arn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE
\ --endpoint-arnarn: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" } }
如需詳細資訊,請參閱AWS 資料庫遷移服務使用者指南中的建立來源和目標端點。
-
如需API詳細資訊,請參閱 命令參考 TestConnection
中的 。 AWS CLI
-