Back Up Your Atlas Cluster
On this page
Note
This feature is not available for any of the following deployments:
M0
clustersM2/M5
clustersFlex clusters
Note
Atlas deprecated M2
and M5
clusters and Serverless instances.
In the near future, Atlas will automatically migrate all 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,
then migrate your Serverless instances automatically.
To preserve backwards compatibility of the APIs for a period of time, Atlas will continue to allow for these migrated clusters to be managed through the same APIs (old and new APIs), including when using Atlas Kubernetes Operator. The backwards compatibility of APIs will remain in place until January 2026, when the old APIs will be removed and only APIs related to Flex clusters will remain in place.
Support for private endpoints on Serverless instances will end in March 2025.
You must update your Atlas Kubernetes Operator configurations to remove private endpoints
by March 2025. You must remove all remaining M2
, M5
, and
Serverless instance features from your Atlas Kubernetes Operator configurations before
January 2026.
If your workloads require Private Endpoints or Continuous Backup and Point-in-Time Restore, switch to Atlas Dedicated Clusters. To learn more, see Migration to Flex Clusters and the Atlas Flex Migration Guide.
Atlas Kubernetes Operator supports cloud backup for your Atlas clusters. Cloud backup uses the native snapshot capabilities of your cloud provider to support full-copy snapshots and localized snapshot storage.
To manage cloud backup with Atlas Kubernetes Operator, you can specify and update the following custom resources:
Custom Resource | Purpose |
---|---|
Defines the backup policy, including the frequency of backups and the length of snapshot retention. | |
Defines the backup schedule, including the time of day that Atlas backs up your database deployment, the number of days back in time to which you can restore, and the backup policy. | |
Defines the characteristics of a cluster. You
must set the Additionally, to configure continuous backup, you must set |
Each time you change any of the supported custom resources, Atlas Kubernetes Operator creates or updates the corresponding Atlas configuration.
Considerations
Review the following considerations:
You can specify one backup policy per backup schedule.
You can specify one backup schedule per cluster, but you can use the same backup schedule for multiple clusters.
Atlas determines the order of nodes to snapshot based on your cluster configuration. To learn more, see Cloud Backups.
Atlas Kubernetes Operator supports automatic snapshot distribution. You can configure this with the
spec.copySetting
field in theAtlasBackupSchedule
Custom Resource.
Note
If you have a Backup Compliance Policy enabled, you
can't modify the backup policy for
an individual cluster below the minimum requirements set in the
Backup Compliance Policy. You can modify the cluster-level backup policy at any
time. Atlas augments any preexisting cluster-level policies
to meet the minimum requirements of the Backup Compliance Policy. All new
clusters use the Backup Compliance Policy. If you reduce the frequency of a
backup schedule, the change applies only to future backups. Any
existing oplog remains for the original window. The minimum
requirements of the Backup Compliance Policy apply. You can
configure extra snapshot retention. You can also view backup details
for all M10+
dedicated clusters including deleted
clusters with retained snapshots. To learn more, see
View Backup Details for Dedicated Clusters.
Limitations
Certain limitations apply to cloud backup. To learn more, see Back Up Your Cluster.
Prerequisites
To enable cloud backup for your Atlas Kubernetes Operator-managed cluster, you must:
Have a running Kubernetes cluster with Atlas Kubernetes Operator deployed.
Ensure your IP address is in the organization's API access list.
Procedure
Follow these steps to enable cloud backup for your Atlas Kubernetes Operator-managed clusters:
Create the backup policy.
To learn more about the parameters for a backup policy, see
AtlasBackupPolicy
Custom Resource.
Example:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasBackupPolicy metadata: name: "atlas-default-backuppolicy" spec: items: frequencyType: "weekly" frequencyInterval: 1 retentionUnit: "days" retentionValue: 7 EOF
Create the backup schedule.
In the spec.policy.name
field, specify the
metadata.name
from the
AtlasBackupPolicy
Custom Resource to apply your backup
policy.
To learn more about the other parameters for a backup schedule
see AtlasBackupSchedule
Custom Resource.
Example:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasBackupSchedule metadata: name: "atlas-default-backupschedule" spec: autoExportEnabled: true copySettings: - cloudProvider: AWS frequencies: - HOURLY regionName: US_EAST_1 shouldCopyOplogs: true referenceHourOfDay: 10 referenceMinuteOfHour: 10 restoreWindowDays: 2 policy: name: atlas-default-backuppolicy namespace: mongodb-atlas-system EOF
Apply the backup schedule to the cluster.
In the spec.backupRef.name
field of the
AtlasDeployment
Custom Resource, specify the
metadata.name
from the
AtlasBackupSchedule
Custom Resource to apply your
backup schedule to the cluster.
Example:
cat <<EOF | kubectl apply -f - apiVersion: atlas.mongodb.com/v1 kind: AtlasDeployment metadata: name: my-atlas-cluster spec: backupRef: name: atlas-default-backupschedule namespace: mongodb-atlas-system EOF