> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# Migrate Programmatic Tools to Flex Clusters

**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.

As of January 22, 2026, Atlas no longer supports `M2` and `M5` clusters and Serverless instances. All existing `M2` and `M5` clusters were migrated to Flex clusters.

Atlas migrated Serverless instances to Free clusters, Flex clusters, or Dedicated clusters according to your usage. To see which tiers Atlas migrated your instances to, consult the [All Clusters](https://cloud.mongodb.com/v2#/clusters) page in the Atlas UI.

All of the tools support Flex clusters. Update your code and replace all references to deprecated instance types with references to Flex Clusters.

**Note:**

If your workloads require [Private Endpoints](https://www.mongodb.com/docs/atlas/security-private-endpoint.md#std-label-private-endpoint-overview) or [Continuous Backup and Point-in-Time Restore](https://www.mongodb.com/docs/atlas/backup/cloud-backup/dedicated-cluster-backup.md#std-label-pit-restore), use Dedicated clusters.

## Migrating API Configuration

The [Cluster](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/group/endpoint-clusters) API endpoints listed in the table in this section were compatible with `M2`/`M5` clusters. As of January 2025, these endpoints managed Flex clusters. These API endpoints reached End of Life (EOL) on January 22, 2026.

As of January 2025, API endpoints for Serverless Instances managed Flex clusters. As of March 2025, Serverless instances are no longer supported. All existing Serverless instances were migrated to Free clusters, Flex clusters, or Dedicated clusters, according to usage. If your Serverless instance was migrated to a Free cluster or Dedicated cluster, use the [Cluster](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/group/endpoint-clusters) API endpoint instead.

Support for creating `M2` and `M5` clusters using the [creategroupcluster](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-creategroupcluster) and Serverless instances using the [creategroupserverlessinstance](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-creategroupserverlessinstance) endpoints ended on January 22, 2026. These endpoints now only support Flex clusters.

The following changes also apply to the listed API endpoints:

| Endpoint | Impact |
| --- | --- |
| [listgroupprivateendpointserverlessinstanceendpoint](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-listgroupprivateendpointserverlessinstanceendpoint) | Deprecated. Returns an error because Serverless instances are no longer supported (as of May 2025). |
| [upgradegroupclustertenantupgrade](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-upgradegroupclustertenantupgrade) | When used on Flex clusters, `upgradeSharedCluster` takes the value set by the user, but doesn't toggle Continuous Backup because Continuous Backup is not available for Flex clusters. |
| [creategroupserverlessinstance](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-creategroupserverlessinstance) | When used on Flex clusters, `createServerlessInstance` takes the value set by the user, but doesn't toggle Continuous Backup because Continuous Backup is not available for Flex clusters. |
| [updategroupserverlessinstance](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-updategroupserverlessinstance) | When used on Flex clusters, `updateServerlessInstance` takes the value set by the user, but doesn't toggle Continuous Backup because Continuous Backup is not available for Flex clusters. |
| [setgroupserverlessperformanceadvisorautoindexing](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-setgroupserverlessperformanceadvisorautoindexing) | When used on Flex clusters, `setServerlessAutoIndexing` takes the value set by the user, but doesn't toggle Auto-Indexing because Auto-Indexing is not available for Flex clusters. |
| [getgroupserverlessperformanceadvisorautoindexing](https://www.mongodb.com/docs/api/doc/atlas-admin-api-v2/operation/operation-getgroupserverlessperformanceadvisorautoindexing) | When used on Flex clusters, `getServerlessAutoIndexing` takes the value set by the user, but doesn't toggle Auto-Indexing because Auto-Indexing is not available for Flex clusters. |

## Terraform Atlas Provider Migration

The [HashiCorp Terraform Provider](https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/flex_cluster) supports Flex clusters. General Terraform support for `M2`/`M5` clusters and Serverless instances ended on January 22, 2026.

Update your Terraform configurations to operate on Flex clusters.

## Go SDK Migration

The Atlas Go SDK (Software Development Kit) supports Flex clusters. General SDK support for `M2`/`M5` clusters and Serverless instances ended on January 22, 2026.

Update your SDK scripts to operate on Flex clusters.

## Atlas CLI Migration

The Atlas CLI supports Flex clusters. To learn more, see [command reference](https://www.mongodb.com/docs/atlas/cli/current/command/atlas/) and select the latest Atlas CLI version from the dropdown.

As of January 2025, continuous cloud backup is no longer supported on Serverless instances. If you used continuous cloud backup on any of your Serverless instances, remove Serverless Instance continuous cloud backup from your Atlas CLI workflows.

General Atlas CLI support for `M2`/`M5` clusters and Serverless instances ended on January 22, 2026. Remove all `M2`/`M5` and Serverless Instance commands from your Atlas CLI workflows.

## Atlas Kubernetes Operator Migration

The [Atlas Kubernetes Operator](https://www.mongodb.com/docs/atlas/operator/) supports Flex clusters.

To manage Flex clusters, you must use Atlas Kubernetes Operator 2.12.0 or later. This version is free of serverless dependencies.

- You can create and manage Flex clusters using the `AtlasDeployment` Custom Resources. To learn more, see the [AtlasDeployment](https://www.mongodb.com/docs/atlas/operator/current/atlasdeployment-custom-resource/) custom resource in the Atlas Kubernetes Operator documentation.

- Use `spec.flexSpec` in the `AtlasDeployment` Custom Resource to configure Flex clusters.

- `M2`/`M5` clusters and Serverless instances are no longer supported. All existing instances have been migrated to Flex clusters or other cluster types.

## Atlas CloudFormation Migration

Atlas CloudFormation and Cloud Development Kit (CDK) support Flex clusters. General support for `M2`/`M5` clusters ended on January 22, 2026.

Support for [Serverless Private Endpoints](https://github.com/mongodb/mongodbatlas-cloudformation-resources/tree/master/cfn-resources/serverless-private-endpoint) and the `Properties.ContinuousBackupEnabled` parameter of the [Serverless Instance](https://github.com/mongodb/mongodbatlas-cloudformation-resources/tree/master/cfn-resources/serverless-instance/docs#mongodbatlasserverlessinstance) resource ended when Atlas CloudFormation introduced Flex cluster support. These resources are no longer available in CloudFormation or CDK. Remove all `M2`/`M5` and Serverless instance features from your Atlas CloudFormation and CDK resources.

**Important:**

Use the `MongoDB::Atlas::Cluster` resource in CloudFormation or the `CfnCluster` resource in CDK instead of the `MongoDB::Atlas::FlexCluster` resource in CloudFormation or the `CfnFlexCluster` resource in CDK to create and manage Flex clusters. `MongoDB::Atlas::Cluster` and `CfnCluster` support Flex clusters, and future upgrades will be available only through these resources. CloudFormation and CDK do not yet support migration between Flex clusters and other cluster types, but support will be added in the future.

For more information, see:

- [CloudFormation Flex Cluster README](https://github.com/mongodb/mongodbatlas-cloudformation-resources/blob/master/cfn-resources/flex-cluster/README.md)

- [CloudFormation Cluster README](https://github.com/mongodb/mongodbatlas-cloudformation-resources/blob/master/cfn-resources/cluster/README.md)

- [CDK Flex Cluster README](https://github.com/mongodb/awscdk-resources-mongodbatlas/blob/main/src/l1-resources/flex-cluster/README.md)

- [CDK Cluster README](https://github.com/mongodb/awscdk-resources-mongodbatlas/blob/main/src/l1-resources/cluster/README.md)
