Docs Menu
Docs Home
/
MongoDB Atlas
/ /

Migrate your programmatic tools from M2, M5, or Serverless Instances to Flex Clusters

On this page

  • Migrating API Configuration
  • Terraform Atlas Provider Migration
  • Go SDK Migration
  • Atlas CLI Migration
  • Atlas Kubernetes Operator Migration
  • Atlas CloudFormation Migration

Important

As of February 2025, you can create Flex clusters, and can no longer create M2 and M5 clusters or Serverless instances in the Atlas UI, Atlas CLI, Atlas Administration API, Atlas Kubernetes Operator, HashiCorp Terraform, or Atlas CloudFormation Resources. You can still use existing M2 and M5 clusters and Serverless instances.

Atlas deprecated M2 and M5 clusters and Serverless instances. Atlas will automatically migrate all existing M2 and M5 clusters to Flex clusters. For Serverless instances, Atlas will determine whether to migrate instances to Free clusters, Flex clusters, or Dedicated clusters according to your usage. To see which tiers Atlas will migrate your instances to, consult the All Clusters page in the Atlas UI.

After your tool of choice supports Flex clusters, update your code by replacing all references to deprecated instance types with references to Flex Clusters.

Note

If your workloads require Private Endpoints or Continuous Backup and Point-in-Time Restore, we recommend that you switch to Atlas Dedicated Clusters.

The Cluster API endpoints listed in the table in this section are compatible with M2/M5 clusters. As of January 2025, these endpoints manage Flex clusters. You can continue using these API endpoints without change until they reach End of Life (EOL) in January 2026.

As of January 2025, API endpoints for Serverless Instances manage Flex clusters. After March 2025, all existing Serverless instances will be migrated to Free clusters, Flex clusters, or Dedicated clusters, according to your usage. If your Serverless instance is migrated to a Free cluster or Dedicated cluster, you must use the Cluster API endpoint instead. To see which tiers Atlas will migrate your instances to, consult the All Clusters page in the Atlas UI.

If you attempt to create an M2 or M5 cluster using the createCluster endpoint, or a Serverless instance using the createServerlessInstance endpoint, between January of 2025 and January of 2026, you will instead create a Flex cluster. Support for these endpoints ends January 2026.

You must replace calls to Serverless instance API endpoints with appropriately configured calls to the Clusters API endpoints before your Serverless instances are migrated to Flex clusters.

The following changes also apply to the listed API endpoints beginning January of 2025.

Endpoint
Impact

Deprecated for new Flex clusters. Will return an error once Serverless instances are migrated to Free, Flex or Dedicated clusters after March 2025.

When used on Flex clusters, upgradeSharedCluster takes the value set by the user, but does not toggle Continuous Backup because Continuous Backup is not available for Flex clusters.

When used on Flex clusters, createServerlessInstance takes the value set by the user, but does not toggle Continuous Backup because Continuous Backup is not available for Flex clusters.

When used on Flex clusters, updateServerlessInstance takes the value set by the user, but does not toggle Continuous Backup because Continuous Backup is not available for Flex clusters.

When used on Flex clusters, setServerlessAutoIndexing takes the value set by the user, but does not toggle Auto-Indexing because Auto-Indexing is not available for Flex clusters.

When used on Flex clusters, getServerlessAutoIndexing takes the value set by the user, but does not toggle Auto-Indexing because Auto-Indexing is not available for Flex clusters.

The HashiCorp Terraform Provider supports Flex clusters. General Terraform support for M2/M5 clusters and Serverless instances will continue until January 2026.

You must update your Terraform configurations to operate on Flex clusters according to the following timelines, depending on which features you use:

Feature
Update Deadline

March, 2025

Serverless PrivateLink Endpoint Service for new Serverless instances

January, 2025

Serverless PrivateLink Endpoint Service for existing Serverless instances

March, 2025

All other features

January, 2026

The Atlas Go SDK supports Flex clusters starting in November of 2024. General SDK support for M2/M5 clusters and Serverless instances continues until January 2026. You must update your SDK scripts to operate on Flex clusters according to the following timelines, depending on which features you use:

Feature
Update Deadline

March, 2025

All other features

January, 2026

The Atlas CLI supports Flex clusters beginning December 2024. To learn more, see command reference and select the latest Atlas CLI version from the dropdown.

Support for continuous cloud backup on Serverless instances ended in January 2025. If you used continuous cloud backup on any of your Serverless instances, you must update your Atlas CLI workflows to remove Serverless Instance continuous cloud backup to avoid errors.

General Atlas CLI support for M2/M5 clusters and Serverless instances continues until January 2026. Before January 2026, you must remove all M2/M5 and Serverless Instance commands from your Atlas CLI workflows.

The Atlas Kubernetes Operator supports Flex clusters beginning February 2025.

  • Until January 2026, to preserve backwards compatibility for a period of time, Atlas allows you to manage migrated clusters through both the Serverless instances and Flex clusters APIs, including when you're using Atlas Kubernetes Operator.

  • You can create and manage Flex clusters in the same AtlasDeployment Custom Resources in which you created and managed Serverless instances and M2 and M5 clusters. To learn more, see the AtlasDeployment custom resource in the Atlas Kubernetes Operator documentation.

  • You can't create NEW M2/M5 clusters and Serverless instances in Atlas. Attempting to do so creates a Flex cluster instead.

  • You can still use existing Serverless instances in Atlas Kubernetes Operator even though existing Serverless instances are deprecated as of early February 2025.

  • For your existing Serverless instances, you can choose to replace references to spec.serverlessSpec in the AtlasDeployment Custom Resource with the configuration for spec.flexSpec. Or, you can continue using the same spec. Managing a deployment via the spec.serverlessSpec in the AtlasDeployment Custom Resource will continue to work even once Atlas automatically migrates these existing clusters to Flex clusters in March 2025.

  • For your existing M2 and M5 clusters, you can choose to replace references to spec.deploymentSpec in the AtlasDeployment Custom Resource with the configuration for spec.flexSpec. Or, you can continue using the same spec. Managing a deployment via the spec.deploymentSpec in the AtlasDeployment Custom Resource will continue to work even once Atlas automatically migrates these existing M2 and M5 clusters to Flex clusters in May 2025.

  • For your existing Serverless instances, if you receive errors during reconciliations related to private endpoints, you must upgrade to Atlas Kubernetes Operator 2.7.1, or replace the serverlessSpec configuration with the configuration for flexSpec in the AtlasDeployment custom resource.

  • For your M2 and M5 clusters, to avoid reconciliation errors that you might notice after the automigration, make the following changes to your CRD configurations:

    • Remove the spec.deploymentSpec.replicationSpecs.zoneName setting.

    • Remove any of the spec.deploymentSpec.replicationSpecs.regionConfigs settings after the first set of settings.

    • Specify replicaset only in the spec.deploymentSpec.clusterType.

    Alternatively, replace references to spec.deploymentSpec in the AtlasDeployment Custom Resource with the configuration for spec.flexSpec.

  • By January 2026, you must remove all remaining M2/M5 and Serverless Instance configurations from your Atlas Kubernetes Operator custom resources because backwards compatibility of APIs ends January 2026, when the old APIs will be removed and only APIs related to Flex clusters will remain in place.

  • Newer releases of Atlas Kubernetes Operator will cease supporting existing M2/M5 clusters and Serverless instances. Older versions of Atlas Kubernetes Operator will continue to support these instance types until January 2026.

Atlas CFN and CDK will support Flex clusters beginning in the first half of 2025. General support for M2/M5 clusters will continue until January 2026.

Support for Serverless Private Endpoints and the Properties.ContinuousBackupEnabled parameter of the Serverless Instance resource will end when Atlas CFN introduces Flex cluster support. You must update your CFN and CDK resources to remove these resources by March 2025. You must remove all M2/M5 and Serverless instance features from your Atlas CFN and CDK resources before January 2026.

Back

Verified HashiCorp Terraform Example