AWS DMS contoh menggunakan AWS CLI - AWS SDKContoh Kode

Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen.

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

AWS DMS contoh menggunakan AWS CLI

Contoh kode berikut menunjukkan cara melakukan tindakan dan mengimplementasikan skenario umum dengan menggunakan AWS Command Line Interface with AWS DMS.

Tindakan adalah kutipan kode dari program yang lebih besar dan harus dijalankan dalam konteks. Sementara tindakan menunjukkan cara memanggil fungsi layanan individual, Anda dapat melihat tindakan dalam konteks dalam skenario terkait.

Setiap contoh menyertakan tautan ke kode sumber lengkap, di mana Anda dapat menemukan instruksi tentang cara mengatur dan menjalankan kode dalam konteks.

Tindakan

Contoh kode berikut menunjukkan cara menggunakanadd-tags-to-resource.

AWS CLI

Untuk menambahkan tag ke sumber daya

add-tags-to-resourceContoh berikut menambahkan tag ke contoh replikasi.

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

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menandai Sumber Daya di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakancreate-endpoint.

AWS CLI

Untuk membuat titik akhir

create-endpointContoh berikut membuat titik akhir untuk sumber Amazon S3.

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

Isi dari s3-settings.json:

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

Output:

{ "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 } } }

Untuk informasi selengkapnya, lihat Bekerja dengan AWS DMS Titik Akhir di Panduan Pengguna Layanan Migrasi AWS Database.

  • Untuk API detailnya, lihat CreateEndpointdi Referensi AWS CLI Perintah.

Contoh kode berikut menunjukkan cara menggunakancreate-event-subscription.

AWS CLI

Untuk membuat daftar langganan acara

create-event-subscriptionContoh berikut membuat langganan acara ke SNS topik Amazon (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

Output:

{ "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 } }

Untuk informasi selengkapnya, lihat Bekerja dengan Acara dan Pemberitahuan di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakancreate-replication-instance.

AWS CLI

Untuk membuat contoh replikasi

create-replication-instanceContoh berikut menciptakan contoh replikasi.

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

Output:

{ "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 } }

Untuk informasi selengkapnya, lihat Bekerja dengan Instans AWS DMS Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakancreate-replication-subnet-group.

AWS CLI

Untuk membuat grup subnet

create-replication-subnet-groupContoh berikut membuat grup yang terdiri dari 3 subnet.

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

Output:

{ "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" } ] } }

Untuk informasi selengkapnya, lihat Menyiapkan Jaringan untuk Instance Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakancreate-replication-task.

AWS CLI

Untuk membuat tugas replikasi

create-replication-taskContoh berikut menciptakan tugas replikasi.

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

Isi dari table-mappings.json:

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

Output:

{ "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" } }

Untuk informasi selengkapnya, lihat Bekerja dengan AWS DMS Tugas di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandelete-connection.

AWS CLI

Untuk menghapus koneksi

delete-connectionContoh berikut memisahkan titik akhir dari contoh replikasi.

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

Output:

{ "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" } }

Untuk informasi selengkapnya, lihat https://docs.aws.amazon.com/dms/latest/userguide/CHAP_EndPoints.creating.html di Panduan Pengguna Layanan Migrasi Database AWS .

Contoh kode berikut menunjukkan cara menggunakandelete-endpoint.

AWS CLI

Untuk menghapus titik akhir

delete-endpointContoh berikut menghapus titik akhir.

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

Output:

{ "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 } } }

Untuk informasi selengkapnya, lihat Bekerja dengan AWS DMS Titik Akhir di Panduan Pengguna Layanan Migrasi AWS Database.

  • Untuk API detailnya, lihat DeleteEndpointdi Referensi AWS CLI Perintah.

Contoh kode berikut menunjukkan cara menggunakandelete-event-subscription.

AWS CLI

Untuk menghapus langganan acara

delete-event-subscriptionContoh berikut menghapus langganan ke SNS topik Amazon.

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

Output:

{ "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 } }

Untuk informasi selengkapnya, lihat Bekerja dengan Acara dan Pemberitahuan di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandelete-replication-instance.

AWS CLI

Untuk menghapus contoh replikasi

Contoh delete-replication-instance berikut menghapus instans replikasi.

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

Output:

{ "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" } }

Untuk informasi selengkapnya, lihat Bekerja dengan Instans AWS DMS Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandelete-replication-subnet-group.

AWS CLI

Untuk menghapus grup subnet

delete-replication-subnet-groupContoh berikut menghapus grup subnet.

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

Output:

(none)

Untuk informasi selengkapnya, lihat Menyiapkan Jaringan untuk Instance Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandelete-replication-task.

AWS CLI

Untuk menghapus tugas replikasi

delete-replication-taskContoh berikut menghapus tugas replikasi.

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

Output:

{ "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" } }

Untuk informasi selengkapnya, lihat Bekerja dengan AWS DMS Tugas di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-account-attributes.

AWS CLI

Untuk menggambarkan atribut akun

describe-account-attributesContoh berikut mencantumkan atribut untuk AWS akun Anda.

aws dms describe-account-attributes

Output:

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

Contoh kode berikut menunjukkan cara menggunakandescribe-certificates.

AWS CLI

Untuk daftar sertifikat yang tersedia

describe-certificatesContoh berikut mencantumkan sertifikat yang tersedia di AWS akun Anda.

aws dms describe-certificates

Output:

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

Untuk informasi selengkapnya, lihat Menggunakan SSL dalam Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-connections.

AWS CLI

Untuk menggambarkan koneksi

describe-connectionsContoh berikut mencantumkan koneksi yang telah Anda uji antara instance replikasi dan titik akhir.

aws dms describe-connections

Output:

{ "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" } ] }

Untuk informasi selengkapnya, lihat Membuat Titik Akhir Sumber dan Target di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-endpoint-types.

AWS CLI

Untuk mencantumkan jenis titik akhir yang tersedia

describe-endpoint-typesContoh berikut mencantumkan tipe SQL titik akhir Saya yang tersedia.

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

Output:

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

Untuk informasi selengkapnya, lihat Bekerja dengan Titik Akhir < AWS DMS https://docs.aws.amazon.com/dms/ latest/userguide/CHAP _Endpoints.html>`__ di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-endpoints.

AWS CLI

Untuk menggambarkan titik akhir

describe-endpointsContoh berikut mencantumkan titik akhir di AWS akun Anda.

aws dms describe-endpoints

Output:

{ "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 } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan AWS DMS Titik Akhir di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-event-categories.

AWS CLI

Untuk menggambarkan kategori acara

describe-event-categoriesContoh berikut mencantumkan kategori acara yang tersedia.

aws dms describe-event-categories

Output:

{ "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" ] } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan Acara dan Pemberitahuan di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-event-subscriptions.

AWS CLI

Untuk menggambarkan langganan acara

describe-event-subscriptionsContoh berikut mencantumkan langganan acara ke SNS topik Amazon.

aws dms describe-event-subscriptions

Output:

{ "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 } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan Acara dan Pemberitahuan di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-events.

AWS CLI

Untuk daftar DMS acara

describe-eventsContoh berikut mencantumkan peristiwa yang berasal dari contoh replikasi.

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

Output:

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

Untuk informasi selengkapnya, lihat Bekerja dengan Acara dan Pemberitahuan di Panduan Pengguna Layanan Migrasi AWS Database.

  • Untuk API detailnya, lihat DescribeEventsdi Referensi AWS CLI Perintah.

Contoh kode berikut menunjukkan cara menggunakandescribe-orderable-replication-instances.

AWS CLI

Untuk menggambarkan contoh replikasi yang dapat dipesan

describe-orderable-replication-instancesContoh berikut mencantumkan jenis contoh replikasi yang dapat Anda pesan.

aws dms describe-orderable-replication-instances

Output:

{ "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... }

Untuk informasi selengkapnya, lihat Bekerja dengan Instans AWS DMS Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-refresh-schemas-status.

AWS CLI

Untuk mencantumkan status penyegaran untuk titik akhir

describe-refresh-schemas-statusContoh berikut mengembalikan status permintaan penyegaran sebelumnya.

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

Output:

{ "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 } }

Contoh kode berikut menunjukkan cara menggunakandescribe-replication-instances.

AWS CLI

Untuk menggambarkan contoh replikasi

describe-replication-instancesContoh berikut mencantumkan contoh replikasi di akun Anda AWS .

aws dms describe-replication-instances

Output:

{ "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 } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan Instans AWS DMS Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-replication-subnet-groups.

AWS CLI

Untuk menampilkan grup subnet yang tersedia

describe-replication-subnet-groupsContoh berikut mencantumkan grup subnet yang tersedia.

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

Output:

{ "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" } ] } ] }

Untuk informasi selengkapnya, lihat Menyiapkan Jaringan untuk Instance Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-replication-task-assessment-results.

AWS CLI

Untuk membuat daftar hasil penilaian tugas replikasi

describe-replication-task-assessment-resultsContoh berikut mencantumkan hasil penilaian tugas sebelumnya.

aws dms describe-replication-task-assessment-results

Output:

{ "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" } ] }

Untuk selengkapnya, lihat Membuat Laporan Penilaian Tugas di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-replication-tasks.

AWS CLI

Untuk menggambarkan tugas replikasi

describe-replication-tasksContoh berikut menjelaskan tugas replikasi saat ini.

aws dms describe-replication-tasks

Output:

{ "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 } } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan AWS DMS Tugas di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakandescribe-schemas.

AWS CLI

Untuk membuat skema basis data

describe-schemasContoh berikut mencantumkan tabel yang tersedia di titik akhir.

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

Output:

{ "Schemas": [ "prodrep" ] }

Untuk informasi selengkapnya, lihat Ini adalah judul topik dalam Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanlist-tags-for-resource.

AWS CLI

Untuk daftar tag untuk sumber daya

list-tags-for-resourceContoh berikut mencantumkan tag untuk contoh replikasi.

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

Output:

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

Untuk informasi selengkapnya, lihat Menandai Sumber Daya di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanmodify-endpoint.

AWS CLI

Untuk memodifikasi titik akhir

modify-endpointContoh berikut menambahkan atribut koneksi tambahan ke titik akhir.

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

Output:

{ "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 } } }

Untuk informasi selengkapnya, lihat Bekerja dengan Titik Akhir < AWS DMS https://docs.aws.amazon.com/dms/ latest/userguide/CHAP _Endpoints.html>`__ di Panduan Pengguna Layanan Migrasi AWS Database.

  • Untuk API detailnya, lihat ModifyEndpointdi Referensi AWS CLI Perintah.

Contoh kode berikut menunjukkan cara menggunakanmodify-event-subscription.

AWS CLI

Untuk mengubah langganan acara

modify-event-subscriptionContoh berikut mengubah jenis sumber langganan acara.

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

Output:

{ "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 } }

Untuk informasi selengkapnya, lihat Bekerja dengan Acara dan Pemberitahuan di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanmodify-replication-instance.

AWS CLI

Untuk memodifikasi contoh replikasi

modify-replication-instanceContoh berikut memodifikasi instance replikasi sehingga menggunakan penerapan Multi-AZ.

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

Output:

{ "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... } }

Untuk informasi selengkapnya, lihat Bekerja dengan Instans AWS DMS Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanmodify-replication-subnet-group.

AWS CLI

Untuk memodifikasi grup subnet

modify-replication-subnet-groupContoh berikut mengubah daftar subnet yang terkait dengan grup subnet.

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

Output:

{ "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" } ] } }

Untuk informasi selengkapnya, lihat Menyiapkan Jaringan untuk Instance Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanmodify-replication-task.

AWS CLI

Untuk memodifikasi tugas replikasi

modify-replication-taskContoh berikut mengubah pemetaan tabel untuk tugas.

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

Isi dari 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": [] } ] }

Output:

{ "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" } }

Untuk informasi selengkapnya, lihat Bekerja dengan AWS DMS Tugas di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanreboot-replication-instance.

AWS CLI

Untuk me-reboot instance replikasi

Contoh reboot-replication-instance berikut mem-boot ulang instans replikasi.

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

Output:

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

Untuk informasi selengkapnya, lihat Bekerja dengan Instans AWS DMS Replikasi di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanrefresh-schemas.

AWS CLI

Untuk me-refresh skema database

refresh-schemasContoh berikut meminta agar AWS DMS menyegarkan daftar skema pada titik akhir.

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"

Output:

{ "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 } }
  • Untuk API detailnya, lihat RefreshSchemasdi Referensi AWS CLI Perintah.

Contoh kode berikut menunjukkan cara menggunakanreload-tables.

AWS CLI

Untuk menyegarkan daftar tabel yang tersedia di titik akhir

reload-tablesContoh berikut memuat ulang daftar tabel yang tersedia di titik akhir.

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

Output:

{ "ReplicationTaskArn": "arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII" }
  • Untuk API detailnya, lihat ReloadTablesdi Referensi AWS CLI Perintah.

Contoh kode berikut menunjukkan cara menggunakanremove-tags-from-resource.

AWS CLI

Untuk menghapus tag dari contoh replikasi

remove-tags-from-resourceContoh berikut menghapus tag dari contoh replikasi.

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

Perintah ini tidak menghasilkan output.

Untuk informasi selengkapnya, lihat Menandai Sumber Daya di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanstart-replication-task-assessment.

AWS CLI

Untuk memulai penilaian tugas

start-replication-task-assessmentContoh berikut memulai penilaian tugas replikasi.

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

Output:

{ "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" } }

Untuk selengkapnya, lihat Membuat Laporan Penilaian Tugas di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanstart-replication-task.

AWS CLI

Untuk memulai tugas replikasi

command-nameContoh berikut mencantumkan widget yang tersedia di AWS akun Anda.

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

Output:

{ "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" } }

Untuk informasi selengkapnya, lihat Bekerja dengan AWS DMS Tugas di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakanstop-replication-task.

AWS CLI

Untuk menghentikan tugas

stop-replication-taskContoh berikut menghentikan tugas.

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

Output:

{ "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" } }

Untuk informasi selengkapnya, lihat Bekerja dengan AWS DMS Tugas di Panduan Pengguna Layanan Migrasi AWS Database.

Contoh kode berikut menunjukkan cara menggunakantest-connection.

AWS CLI

Untuk menguji koneksi ke titik akhir

test-connectionContoh berikut menguji apakah titik akhir dapat diakses dari contoh replikasi.

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

Output:

{ "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" } }

Untuk informasi selengkapnya, lihat Membuat titik akhir sumber dan target di Panduan Pengguna Layanan Migrasi AWS Database.

  • Untuk API detailnya, lihat TestConnectiondi Referensi AWS CLI Perintah.