OpenMCF logoOpenMCF

Loading...

MongoDB Atlas

Deploys a MongoDB Atlas cluster with configurable cluster type, replication topology, cloud provider selection, instance sizing, and backup settings. All cluster-level parameters are managed declaratively through the spec, including electable and read-only node counts, auto-scaling, and MongoDB version.

What Gets Created

When you deploy a MongodbAtlas resource, OpenMCF provisions:

  • MongoDB Atlas Advanced Cluster — a mongodbatlas_advanced_cluster resource with the specified cluster type, replication spec, region configuration, electable/read-only node topology, backup, and auto-scaling settings
  • MongoDB Atlas Provider — configured using explicit API key credentials from provider config or environment variables

Prerequisites

  • MongoDB Atlas API keys configured via environment variables (MONGODB_ATLAS_PUBLIC_KEY, MONGODB_ATLAS_PRIVATE_KEY) or OpenMCF provider config
  • A MongoDB Atlas project with its project ID — the cluster is created inside this project
  • Sufficient Atlas permissions for the API key to create and manage clusters in the target project

Quick Start

Create a file mongodb-atlas.yaml:

apiVersion: atlas.openmcf.org/v1
kind: MongodbAtlas
metadata:
  name: my-cluster
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.MongodbAtlas.my-cluster
spec:
  clusterConfig:
    projectId: "64a1234567890abcdef12345"
    clusterType: REPLICASET
    electableNodes: 3
    priority: 7
    providerName: AWS
    providerInstanceSizeName: M10
    mongoDbMajorVersion: "7.0"

Deploy:

openmcf apply -f mongodb-atlas.yaml

This creates a 3-node replica set cluster on AWS using M10 instances running MongoDB 7.0.

Configuration Reference

Required Fields

FieldTypeDescriptionValidation
clusterConfig.projectIdstringThe unique ID for the MongoDB Atlas project where the cluster is created.—
clusterConfig.clusterTypestringType of cluster to deploy. Accepted values: REPLICASET, SHARDED, GEOSHARDED. You cannot convert a sharded cluster to a replica set after creation.—
clusterConfig.electableNodesint32Number of electable nodes in the region. Electable nodes can become primary and serve local reads. Total across all regions must be 3, 5, or 7. Set to 0 if the region has priority of 0.—
clusterConfig.priorityint32Election priority of the region (1-7). Priority 7 designates the Preferred Region where Atlas places the primary node. Each region must have a unique priority, with each region exactly one less than the previous.—
clusterConfig.providerNamestringCloud provider for the cluster servers. Accepted values: AWS, GCP, AZURE, TENANT (multi-tenant, only valid with M2 or M5 instance sizes).—
clusterConfig.providerInstanceSizeNamestringInstance size for all data-bearing servers in the cluster. Each size has a default storage capacity and RAM allocation. Examples: M0, M2, M5, M10, M20, M30, M40, M50, M60, M80, M200, M300.—

Optional Fields

FieldTypeDefaultDescription
clusterConfig.readOnlyNodesint320Number of read-only nodes in the region. Read-only nodes can never become primary but can serve local reads.
clusterConfig.cloudBackupboolfalseEnable or disable cloud backup for the cluster.
clusterConfig.autoScalingDiskGbEnabledboolfalseEnable automatic disk storage scaling. When enabled, Atlas automatically increases storage capacity when usage approaches the provisioned limit.
clusterConfig.mongoDbMajorVersionstring"7.0"MongoDB major version to deploy. Supported versions for M10+ clusters: 4.4, 5.0, 6.0, 7.0. If omitted, Atlas deploys 7.0. For M0, M2, or M5 instances, Atlas deploys 5.0.

Examples

Basic Replica Set on AWS

A minimal 3-node replica set on AWS with M10 instances, suitable for development or small production workloads:

apiVersion: atlas.openmcf.org/v1
kind: MongodbAtlas
metadata:
  name: dev-cluster
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.MongodbAtlas.dev-cluster
spec:
  clusterConfig:
    projectId: "64a1234567890abcdef12345"
    clusterType: REPLICASET
    electableNodes: 3
    priority: 7
    providerName: AWS
    providerInstanceSizeName: M10
    mongoDbMajorVersion: "7.0"

Production Replica Set with Backup and Auto-Scaling

A production-grade replica set on GCP with cloud backup enabled, auto-scaling disk storage, and read-only nodes for offloading analytics queries:

apiVersion: atlas.openmcf.org/v1
kind: MongodbAtlas
metadata:
  name: prod-cluster
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.MongodbAtlas.prod-cluster
spec:
  clusterConfig:
    projectId: "64a1234567890abcdef12345"
    clusterType: REPLICASET
    electableNodes: 3
    priority: 7
    readOnlyNodes: 2
    cloudBackup: true
    autoScalingDiskGbEnabled: true
    providerName: GCP
    providerInstanceSizeName: M30
    mongoDbMajorVersion: "7.0"

Sharded Cluster on Azure

A sharded cluster on Azure with M40 instances for high-throughput workloads that require horizontal scaling across multiple shards:

apiVersion: atlas.openmcf.org/v1
kind: MongodbAtlas
metadata:
  name: analytics-cluster
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.MongodbAtlas.analytics-cluster
spec:
  clusterConfig:
    projectId: "64a1234567890abcdef12345"
    clusterType: SHARDED
    electableNodes: 3
    priority: 7
    readOnlyNodes: 1
    cloudBackup: true
    autoScalingDiskGbEnabled: true
    providerName: AZURE
    providerInstanceSizeName: M40
    mongoDbMajorVersion: "6.0"

Stack Outputs

After deployment, the following outputs are available in status.outputs:

OutputTypeDescription
idstringProvider-assigned unique ID for the MongoDB Atlas cluster
bootstrapEndpointstringStandard connection string in SRV format (mongodb+srv://...), recommended for MongoDB drivers
crnstringThe cluster identifier, used for resource identification and API operations
restEndpointstringStandard connection string in legacy format (mongodb://host:port,...)

Related Components

No other OpenMCF components have direct foreign key references to MongodbAtlas. This component is typically deployed as a standalone resource within a MongoDB Atlas project.

Next article

AUTH0

AUTH0 The following AUTH0 resources can be deployed using OpenMCF: Client Connection Event Stream Resource Server
Read next article