Sources
DocumentDB
Learn how to use Artie to replicate data from DocumentDB via change streams.
To run Artie with DocumentDB, you must have SSH tunnels enabled as DocumentDB only allows access within your VPC. See SSH tunneling for instructions!
Required settings
- Cluster endpoint (find this under
Configuration
) - Port (default is
27017
) - Service account
- Database name
- Ensure the database has change stream enabled
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
});
Was this page helpful?