Artie Transfer
Search
K

DocumentDB

DocumentDB is Amazon's fork of MongoDB which have some minor behavioral differences. In this guide, we will go over how to collect the necessary information to replicate from DocumentDB.

Introduction

We will be running Debezium to fetch CDC logs from DocumentDB by using Change Streams which is a more performant and reliable approach than tailing the oplog.
To run Artie with DocumentDB, you must have SSH tunnels enabled as DocumentDB only allows access within your VPC. See Enabling SSH Tunneling for instructions!

Finding your DocumentDB settings

This is necessary so that we are able to run a Debezium deployment to subscribe to Change Events within your MongoDB cluster. To see additional configuration properties, please click here to see Debezium's documentation.
Name
Description
Cluster endpoint
Click on your DocumentDB cluster and you will find this under Configuration.
Port
The default port is 27017, change it if you are running it on another port.
Username
Username for authentication into your database.
Password
Password for authentication into your database.

Enabling change streams and creation of a service account

// Creating a service account for Artie to subscribe to change stream
db.createUser({user: "artie", pwd: "changeme", roles: ["read"]});
// Grants access to DocumentDB change streams
use admin;
db.grantRolesToUser("artie", [
{ role: "readAnyDatabase", db: "admin" }
]);
// Depending on the permission granularity you want, you can use the following commands to grant permissions to the service account.
// Enable change streams for all collections in database "changeme"
db.adminCommand({
modifyChangeStreams: 1,
database: "changeme",
collection: "",
enable: true
});
// Enable change streams for all collections in all databases
db.adminCommand({
modifyChangeStreams: 1,
database: "",
collection: "",
enable: true
});
// Advanced: Enable change streams for the collection "foo" in database "changeme"
db.adminCommand({
modifyChangeStreams: 1,
database: "changeme",
collection: "foo",
enable: true
});

Supported types

Types are sourced from the MongoDB extended JSON specification.
  • Array
  • Binary
  • Array
  • Boolean
  • ObjectID
  • Int32
  • Int64
  • Double
  • Decimal128
  • Code
  • CodeWScope
  • RegEx
  • Datetime
  • Timestamp
  • String
Last modified 2mo ago