Configuring a MongoDB Realm Application for the Cosync Engine storage module is done through the Cosync Portal. The process is relatively easy assuming the developer has gathered all the appropriate Realm API Keys and configured their Amazon S3 bucket correctly. The Realm API Keys necessary to configure the Cosync Engine Storage module are:
- MongoDB Realm Application Id
- MongoDB Realm Project Id
- Realm project or organization Public API Key
- Realm project or organization Private API key
- MongoDB Realm Service Id
Retrieving these values is explained in the Realm API Keys section of this documentation.
The Amazon S3 keys that will be needed to configure the Cosync Engine Storage module for a MongoDB Realm Application include the following:
- AWS user access key
- AWS user secret access key
- AWS S3 bucket name
- AWS bucket region code
Configuring an Amazon S3 bucket and collecting these key values is explained in the Amazon S3 Setup section of this documentation.
The developer must first gather all these keys and save them in a file for safe keeping. These keys must be kept secret because they are effectively programmatic passwords to both the MongoDB Realm Application cloud instance and the Amazon S3 account. A best practice is to save them to an encrypted file on a removable key fab, and maybe a printout that is kept in a safe.
Enter Keys from MongoDB Realm Tab
Once all the keys have been gathered, configuring a MongoDB Realm Application for the Cosync Engine Storage module is very easy. First, the developer should go to the MongoDB Realm tab within the application detail, and enter the Realm App Id as shown below.
Next, the developer should press the button Init Cosync Engine and fill in the Realm API keys as shown here:
Finally, the developer should enter the Amazon S3 keys and bucket parameters as shown here:
The initialization should take no more than an about 10 seconds, after the developer hits the Submit button. For proof that the configuration took place, the developer can go to the MongoDB Realm Application portal and verify that the Cosync functions were installed properly. Note: the configuration process does not install any schema information in the MongoDB Realm Application, that takes place the first time a client connects to the MongoDB Realm Application. Also, the first time a client does a write to a MongoDB Realm Application, there can be a latency of several minutes. This is not a bug, rather this is part of the initialization process between MongoDB Realm and the backend Atlas Cluster to which it connects. This delay is only experienced on the first write, and can be quite disconcerting to the developer.