Search code examples
postgresqlamazon-web-servicesamazon-rdsaws-dmsaws-documentdb

Amazon DMS (Database Migration Service) endpoints compatibility


I have to migrate some data from a DocumentDB as source to a PostgreSQL RDS as destination, are these two endpoints compatible with the Database Migration Service?

I tried to search in the online guide at the following link (Online Guide) but I have found nothing that explicitly says that that two endpoint are compatible and how the tool works.


Solution

  • It does work. There are several configurations that can be made on the source endpoint (DocumentDB) depending on how you want to have the data in the target database. For example, if the document metadata mode is selected, then this document:

    rs0:PRIMARY> db.docdbcollection.find()
    { "_id" : ObjectId("62444bd3a8f382958e5b58b9"), "name" : "foo", "age" : 25 }
    

    will be saved in PostgreSQL as:

    postgres=> select * from mydb.docdbcollection;
                                           _doc
    -----------------------------------------------------------------------------------
     { "_id" : { "$oid" : "62444bd3a8f382958e5b58b9" }, "name" : "foo", "age" : 25.0 }
    (1 row)
    

    If the metadata mode table is chosen, then DMS will extract the keys and write them as columns on target, ending up with something like this:

    postgres=> select * from mydb.docdbcollection;
             oid__id          | name | age
    --------------------------+------+-----
     62444bd3a8f382958e5b58b9 | foo  |  25
    (1 row)