Amazon DMS examples using Amazon CLI
The following code examples show you how to perform actions and implement common scenarios by using the Amazon Command Line Interface with Amazon DMS.
Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.
Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.
Topics
Actions
The following code example shows how to use add-tags-to-resource.
- Amazon CLI
-
To add tags to a resource
The following
add-tags-to-resourceexample adds tags to a replication instance.aws dms add-tags-to-resource \ --resource-arnarn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE\ --tagsKey=Environment,Value=PRODKey=Project,Value=dbMigrationThis command produces no output.
For more information, see Tagging Resources
in the Amazon Database Migration Service User Guide. -
For API details, see AddTagsToResource
in Amazon CLI Command Reference.
-
The following code example shows how to use create-endpoint.
- Amazon CLI
-
To create an endpoint
The following
create-endpointexample creates an endpoint for an Amazon S3 source.aws dms create-endpoint \ --endpoint-typesource\ --engine-names3\ --endpoint-identifiersrc-endpoint\ --s3-settingsfile://s3-settings.jsonContents of
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 } } }For more information, see Working with Amazon DMS Endpoints
in the Amazon Database Migration Service User Guide. -
For API details, see CreateEndpoint
in Amazon CLI Command Reference.
-
The following code example shows how to use create-event-subscription.
- Amazon CLI
-
To list event subscriptions
The following
create-event-subscriptionexample creates an event subscription to an Amazon SNS topic (my-sns-topic).aws dms create-event-subscription \ --subscription-namemy-dms-events\ --sns-topic-arnarn:aws:sns:us-east-1:123456789012:my-sns-topicOutput:
{ "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 } }For more information, see Working with Events and Notifications
in the Amazon Database Migration Service User Guide. -
For API details, see CreateEventSubscription
in Amazon CLI Command Reference.
-
The following code example shows how to use create-replication-instance.
- Amazon CLI
-
To create a replication instance
The following
create-replication-instanceexample creates a replication instance.aws dms create-replication-instance \ --replication-instance-identifiermy-repl-instance\ --replication-instance-classdms.t2.micro\ --allocated-storage5Output:
{ "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 } }For more information, see Working with an Amazon DMS Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see CreateReplicationInstance
in Amazon CLI Command Reference.
-
The following code example shows how to use create-replication-subnet-group.
- Amazon CLI
-
To create a subnet group
The following
create-replication-subnet-groupexample creates a group consisting of 3 subnets.aws dms create-replication-subnet-group \ --replication-subnet-group-identifiermy-subnet-group\ --replication-subnet-group-description"my subnet group"\ --subnet-idssubnet-da327bf6subnet-bac383e0subnet-d7c825e8Output:
{ "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" } ] } }For more information, see Setting Up a Network for a Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see CreateReplicationSubnetGroup
in Amazon CLI Command Reference.
-
The following code example shows how to use create-replication-task.
- Amazon CLI
-
To create a replication task
The following
create-replication-taskexample creates a replication task.aws dms create-replication-task \ --replication-task-identifiermovedata\ --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.jsonContents of
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" } }For more information, see Working with Amazon DMS Tasks
in the Amazon Database Migration Service User Guide. -
For API details, see CreateReplicationTask
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-connection.
- Amazon CLI
-
To delete a connection
The following
delete-connectionexample disassociates an endpoint from a replication instance.aws dms delete-connection \ --endpoint-arnarn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA\ --replication-instance-arnarn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUEOutput:
{ "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" } }For more information, see https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.Creating.html
in the Amazon Database Migration Service User Guide. -
For API details, see DeleteConnection
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-endpoint.
- Amazon CLI
-
To delete an endpoint
The following
delete-endpointexample deletes an endpoint.aws dms delete-endpoint \ --endpoint-arnarn:aws:dms:us-east-1:123456789012:endpoint:OUJJVXO4XZ4CYTSEG5XGMN2R3YOutput:
{ "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 } } }For more information, see Working with Amazon DMS Endpoints
in the Amazon Database Migration Service User Guide. -
For API details, see DeleteEndpoint
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-event-subscription.
- Amazon CLI
-
To delete an event subscription
The following
delete-event-subscriptionexample deletes a subscription to an Amazon SNS topic.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 } }For more information, see Working with Events and Notifications
in the Amazon Database Migration Service User Guide. -
For API details, see DeleteEventSubscription
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-replication-instance.
- Amazon CLI
-
To delete a replication instance
The following
delete-replication-instanceexample deletes a replication instance.aws dms delete-replication-instance \ --replication-instance-arnarn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUEOutput:
{ "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" } }For more information, see Working with an Amazon DMS Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see DeleteReplicationInstance
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-replication-subnet-group.
- Amazon CLI
-
To delete a subnet group
The following
delete-replication-subnet-groupexample deletes a subnet group.aws dms delete-replication-subnet-group \ --replication-subnet-group-identifiermy-subnet-groupOutput:
(none)For more information, see Setting Up a Network for a Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see DeleteReplicationSubnetGroup
in Amazon CLI Command Reference.
-
The following code example shows how to use delete-replication-task.
- Amazon CLI
-
To delete a replication task
The following
delete-replication-taskexample deletes a replication task.aws dms delete-replication-task \ --replication-task-arnarn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FIIOutput:
{ "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" } }For more information, see Working with Amazon DMS Tasks
in the Amazon Database Migration Service User Guide. -
For API details, see DeleteReplicationTask
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-account-attributes.
- Amazon CLI
-
To describe account attributes
The following
describe-account-attributesexample lists the attributes for your Amazon account.aws dms describe-account-attributesOutput:
{ "AccountQuotas": [ { "AccountQuotaName": "ReplicationInstances", "Used": 1, "Max": 20 }, { "AccountQuotaName": "AllocatedStorage", "Used": 5, "Max": 10000 }, ...remaining output omitted... ], "UniqueAccountIdentifier": "cqahfbfy5xee" }-
For API details, see DescribeAccountAttributes
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-certificates.
- Amazon CLI
-
To list the available certificates
The following
describe-certificatesexample lists the available certificates in your Amazon account.aws dms describe-certificatesOutput:
{ "Certificates": [ { "CertificateIdentifier": "my-cert", "CertificateCreationDate": 1543259542.506, "CertificatePem": "-----BEGIN CERTIFICATE-----\nMIID9DCCAtygAwIBAgIBQjANBgkqhkiG9w0BAQ ...U" ... remaining output omittted ... } ] }For more information, see Using SSL
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeCertificates
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-connections.
- Amazon CLI
-
To describe connections
The following
describe-connectionsexample lists the connections that you have tested between a replication instance and an endpoint.aws dms describe-connectionsOutput:
{ "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" } ] }For more information, see Creating Source and Target Endpoints
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeConnections
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-endpoint-types.
- Amazon CLI
-
To list the available endpoint types
The following
describe-endpoint-typesexample lists the MySQL endpoint types that are available.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" } ] }For more information, see Working with Amazon DMS Endpoints <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.html>`__ in the Amazon Database Migration Service User Guide.
-
For API details, see DescribeEndpointTypes
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-endpoints.
- Amazon CLI
-
To describe endpoints
The following
describe-endpointsexample lists the endpoints in your Amazon account.aws dms describe-endpointsOutput:
{ "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 } ] }For more information, see Working with Amazon DMS Endpoints
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeEndpoints
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-event-categories.
- Amazon CLI
-
To describe event categories
The following
describe-event-categoriesexample lists the available event categories.aws dms describe-event-categoriesOutput:
{ "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" ] } ] }For more information, see Working with Events and Notifications
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeEventCategories
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-event-subscriptions.
- Amazon CLI
-
To describe event subscriptions
The following
describe-event-subscriptionsexample lists the event subscriptions to an Amazon SNS topic.aws dms describe-event-subscriptionsOutput:
{ "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 } ] }For more information, see Working with Events and Notifications
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeEventSubscriptions
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-events.
- Amazon CLI
-
To list DMS events
The following
describe-eventsexample lists the events that originated from a replication instance.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 } ] }For more information, see Working with Events and Notifications
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeEvents
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-orderable-replication-instances.
- Amazon CLI
-
To describe orderable replication instances
The following
describe-orderable-replication-instancesexample lists replication instance types that you can order.aws dms describe-orderable-replication-instancesOutput:
{ "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... }For more information, see Working with an Amazon DMS Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeOrderableReplicationInstances
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-refresh-schemas-status.
- Amazon CLI
-
To list the refresh status for an endpoint
The following
describe-refresh-schemas-statusexample returns the status of a previous refresh request.aws dms describe-refresh-schemas-status \ --endpoint-arnarn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWAOutput:
{ "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 } }-
For API details, see DescribeRefreshSchemasStatus
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-replication-instances.
- Amazon CLI
-
To describe replication instances
The following
describe-replication-instancesexample lists the replication instances in your Amazon account.aws dms describe-replication-instancesOutput:
{ "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 } ] }For more information, see Working with an Amazon DMS Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeReplicationInstances
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-replication-subnet-groups.
- Amazon CLI
-
To display the available subnet groups
The following
describe-replication-subnet-groupsexample lists the available subnet groups.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" } ] } ] }For more information, see Setting Up a Network for a Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeReplicationSubnetGroups
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-replication-task-assessment-results.
- Amazon CLI
-
To list the results of replication task assessmentss
The following
describe-replication-task-assessment-resultsexample lists the results of a prior task assesssment.aws dms describe-replication-task-assessment-resultsOutput:
{ "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" } ] }For more information, see Creating a Task Assessment Report
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeReplicationTaskAssessmentResults
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-replication-tasks.
- Amazon CLI
-
To describe a replication task
The following
describe-replication-tasksexample describes current replication tasks.aws dms describe-replication-tasksOutput:
{ "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 } } ] }For more information, see Working with Amazon DMS Tasks
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeReplicationTasks
in Amazon CLI Command Reference.
-
The following code example shows how to use describe-schemas.
- Amazon CLI
-
To desscribe database schemas
The following
describe-schemasexample lists the available tables at an endpoint.aws dms describe-schemas \ --endpoint-arn"arn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWA"Output:
{ "Schemas": [ "prodrep" ] }For more information, see This is the topic title
in the Amazon Database Migration Service User Guide. -
For API details, see DescribeSchemas
in Amazon CLI Command Reference.
-
The following code example shows how to use list-tags-for-resource.
- Amazon CLI
-
To list the tags for a resource
The following
list-tags-for-resourceexample lists the tags for a replication instance.aws dms list-tags-for-resource \ --resource-arnarn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUEOutput:
{ "TagList": [ { "Key": "Project", "Value": "dbMigration" }, { "Key": "Environment", "Value": "PROD" } ] }For more information, see Tagging Resources
in the Amazon Database Migration Service User Guide. -
For API details, see ListTagsForResource
in Amazon CLI Command Reference.
-
The following code example shows how to use modify-endpoint.
- Amazon CLI
-
To modify an endpoint
The following
modify-endpointexample adds an extra connection attribute to an endpoint.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 } } }For more information, see Working with Amazon DMS Endpoints <https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Endpoints.html>`__ in the Amazon Database Migration Service User Guide.
-
For API details, see ModifyEndpoint
in Amazon CLI Command Reference.
-
The following code example shows how to use modify-event-subscription.
- Amazon CLI
-
To modify an event subscription
The following
modify-event-subscriptionexample changes the source type of an event subscription.aws dms modify-event-subscription \ --subscription-name"my-dms-events"\ --source-typereplication-taskOutput:
{ "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 } }For more information, see Working with Events and Notifications
in the Amazon Database Migration Service User Guide. -
For API details, see ModifyEventSubscription
in Amazon CLI Command Reference.
-
The following code example shows how to use modify-replication-instance.
- Amazon CLI
-
To modify a replication instance
The following
modify-replication-instanceexample modifies a replication instance so that it uses a Multi-AZ deployment.aws dms modify-replication-instance \ --replication-instance-arnarn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE\ --multi-azOutput:
{ "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... } }For more information, see Working with an Amazon DMS Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see ModifyReplicationInstance
in Amazon CLI Command Reference.
-
The following code example shows how to use modify-replication-subnet-group.
- Amazon CLI
-
To modify a subnet group
The following
modify-replication-subnet-groupexample changes the lists of subnets associated with a subnet group.aws dms modify-replication-subnet-group \ --replication-subnet-group-identifiermy-subnet-group\ --subnet-idsubnet-da327bf6subnet-bac383e0Output:
{ "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" } ] } }For more information, see Setting Up a Network for a Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see ModifyReplicationSubnetGroup
in Amazon CLI Command Reference.
-
The following code example shows how to use modify-replication-task.
- Amazon CLI
-
To modify a replication task
The following
modify-replication-taskexample changes the table mappings for a task.aws dms modify-replication-task \ --replication-task-arn"arn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII"\ --table-mappingsfile://table-mappings.jsonContents of
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" } }For more information, see Working with Amazon DMS Tasks
in the Amazon Database Migration Service User Guide. -
For API details, see ModifyReplicationTask
in Amazon CLI Command Reference.
-
The following code example shows how to use reboot-replication-instance.
- Amazon CLI
-
To reboot a replication instance
The following
reboot-replication-instanceexample reboots a replication instance.aws dms reboot-replication-instance \ --replication-instance-arnarn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUEOutput:
{ "ReplicationInstance": { "ReplicationInstanceIdentifier": "my-repl-instance", "ReplicationInstanceClass": "dms.t2.micro", "ReplicationInstanceStatus": "rebooting", "AllocatedStorage": 5, "InstanceCreateTime": 1590011235.952, ... output omitted ... } }For more information, see Working with an Amazon DMS Replication Instance
in the Amazon Database Migration Service User Guide. -
For API details, see RebootReplicationInstance
in Amazon CLI Command Reference.
-
The following code example shows how to use refresh-schemas.
- Amazon CLI
-
To refresh database schemas
The following
refresh-schemasexample requests that Amazon DMS refresh the list of schemas at an endpoint.aws dms refresh-schemas \ --replication-instance-arnarn: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 } }-
For API details, see RefreshSchemas
in Amazon CLI Command Reference.
-
The following code example shows how to use reload-tables.
- Amazon CLI
-
To refresh the list of tables available at an endpoint
The following
reload-tablesexample reloads the list of available tables at an endpoint.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" }-
For API details, see ReloadTables
in Amazon CLI Command Reference.
-
The following code example shows how to use remove-tags-from-resource.
- Amazon CLI
-
To remove tags from a replication instance
The following
remove-tags-from-resourceexample removes tags from a replication instance.aws dms remove-tags-from-resource \ --resource-arnarn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE\ --tag-keysEnvironmentProjectThis command produces no output.
For more information, see Tagging Resources
in the Amazon Database Migration Service User Guide. -
For API details, see RemoveTagsFromResource
in Amazon CLI Command Reference.
-
The following code example shows how to use start-replication-task-assessment.
- Amazon CLI
-
To start a task assessment
The following
start-replication-task-assessmentexample starts a replication task assessment.aws dms start-replication-task-assessment \ --replication-task-arnarn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FIIOutput:
{ "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" } }For more information, see Creating a Task Assessment Report
in the Amazon Database Migration Service User Guide. -
For API details, see StartReplicationTaskAssessment
in Amazon CLI Command Reference.
-
The following code example shows how to use start-replication-task.
- Amazon CLI
-
To start a replication task
The following
command-nameexample lists the available widgets in your Amazon account.aws dms start-replication-task \ --replication-task-arnarn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FII\ --start-replication-task-typereload-targetOutput:
{ "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" } }For more information, see Working with Amazon DMS Tasks
in the Amazon Database Migration Service User Guide. -
For API details, see StartReplicationTask
in Amazon CLI Command Reference.
-
The following code example shows how to use stop-replication-task.
- Amazon CLI
-
To stop a task
The following
stop-replication-taskexample stops a task.aws dms stop-replication-task \ --replication-task-arnarn:aws:dms:us-east-1:123456789012:task:K55IUCGBASJS5VHZJIINA45FIIOutput:
{ "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" } }For more information, see Working with Amazon DMS Tasks
in the Amazon Database Migration Service User Guide. -
For API details, see StopReplicationTask
in Amazon CLI Command Reference.
-
The following code example shows how to use test-connection.
- Amazon CLI
-
To test a connection to an endpoint
The following
test-connectionexample tests whether an endpoint can be accessed from a replication instance.aws dms test-connection \ --replication-instance-arnarn:aws:dms:us-east-1:123456789012:rep:T3OM7OUB5NM2LCVZF7JPGJRNUE\ --endpoint-arnarn:aws:dms:us-east-1:123456789012:endpoint:6GGI6YPWWGAYUVLKIB732KEVWAOutput:
{ "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" } }For more information, see Creating source and target endpoints
in the Amazon Database Migration Service User Guide. -
For API details, see TestConnection
in Amazon CLI Command Reference.
-