Docs Menu

Docs HomeLaunch & Manage MongoDBMongoDB Atlas

Define Data Stores for a Federated Database Instance

On this page

  • Data Federation Access
  • Privilege Actions
  • Set or Update Federated Database Instance Configuration
  • Validate Federated Database Instance Configuration
  • Retrieve Federated Database Instance Configuration
  • Generate Wildcard Collections

Creating a federated database instance starts with creating a storage configuration in JSON format. The storage configuration defines your data stores and maps those data stores to collections you can query.

Atlas Data Federation supports S3 buckets, Azure Blob Storage containers, Atlas clusters, Atlas online archives, and publicly accessible URLs as data stores. You must define mappings in your federated database instance to your S3 bucket, Atlas cluster, Atlas online archive, and HTTP data stores to run queries against your data.

Important

Information in your storage configuration is visible internally at MongoDB and stored as operational data to monitor and improve the performance of Atlas Data Federation. We recommend that you don't use PII in your configurations.

This page describes the administration commands you can use to set, update, and retrieve federated database instance storage configuration. Other pages in this section describe the settings you can define in your federated database instance storage configuration for your various data stores:

When you create a federated database instance, you grant Atlas either read only or read and write access to S3 buckets in your AWS account. To access your Atlas clusters, Atlas uses your existing Role Based Access Controls. You can view and edit the data storage configuration that maps data from your S3 buckets and Atlas clusters to federated database instances and virtual collections.

Privilege actions define the operations that you can perform on your federated database instance. You can grant the following Atlas Data Federation privileges:

  • When you create or modify custom roles from the Atlas User Interface

  • In the actions.action request body parameter when you create or update a custom role from the Atlas API

sqlGetSchema

Retrieve the schema stored for a collection or view using the sqlGetSchema command.

sqlSetSchema

Set or delete the schema for a collection or view using the sqlSetSchema command.

viewAllHistory

Retrieve details about the queries that were run in the past using $queryHistory.

outToAzure

Write data from any one of the supported federated database instance stores or multiple supported federated database instance stores to your Azure Blob Storage container using $out.

outToS3

Write data from any one of the supported federated database instance stores or multiple supported federated database instance stores to your S3 bucket using $out.

storageGetConfig

Retrieve your federated database instance storage configuration using the storageGetConfig command.

storageSetConfig

Set or update your federated database instance storage configuration using the storageSetConfig command.

Once connected to the federated database instance, you can use the following database commands to set or update the federated database instance configuration:

use admin
db.runCommand( { "storageSetConfig" : <config> } )

Replace <config> with the configuration for the federated database instance. You can validate your configuration before setting or updating the federated database instance configuration by running the storageValidateConfig command.

To set or update the storage configuration through the Atlas UI:

1
2
3
  • For a guided experience, click Visual Editor.

  • To edit the raw JSON, click JSON Editor.

4
5

You can also set and manage the storage configuration using the Manage a Federated Database Instance.

You can run the following command to validate your federated database instance configuration.

use admin
db.runCommand( { "storageValidateConfig" : <config> } )

Replace <config> with the configuration for the federated database instance.

The command returns the following if your federated database instance configuration is valid:

{ "ok" : 1 }

The command returns the list of errors in the errs field if your federated database instance storage configuration is invalid:

{
"ok" : 1,
"errs" : [
"<error>",
"<error>",
...
]
}

Once connected to the federated database instance, you can use the following database commands to retrieve the federated database instance configuration:

use admin
db.runCommand( { "storageGetConfig" : 1 } )

The command returns the current federated database instance configuration.

You can dynamically generate collection names that map to data in your S3 bucket or Atlas cluster. To dynamically generate collection names, specify the wildcard, *, as the value for the collection name setting in your federated database instance storage configuration. You can't dynamically generate collection names in your federated database instance storage configuration that map to data in your HTTP or HTTPS data store.

You can use the storageSetConfig command to configure the settings for generating wildcard (*) collections.

To learn more about the configuration settings for generating wildcard collections, see:

←  Run Queries Against Your Federated Database InstanceAWS S3 Bucket →