For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Auto-Scaling Operations and Alerts

This page covers auto-scaling operations: reviewing auto-scaling activity, configuring auto-scaling alerts, enhancing auto-scaling with effective fields, and getting support for auto-scaling.

You can view Activity Feed to review the events for each Atlas project. When any auto-scaling event occurs, Atlas logs the event in the project Activity Feed.

Atlas uses the following audit auto-scaling events.

Each auto-scaling event in the Activity Feed includes detailed information about what triggered the scaling action, including:

  • The specific metric that triggered the auto-scaling event (such as CPU utilization, memory usage, or disk space).

  • The threshold value that was exceeded.

  • Whether the scaling was triggered by reactive auto-scaling (in response to current resource usage) or predictive auto-scaling (in anticipation of forecasted demand).

To view or download only auto-scaling events:

In Atlas, go to the Project Activity Feed page.

  1. If it's not already displayed, select the organization that contains your desired project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your desired project from the Projects menu in the navigation bar.

  3. In the sidebar, click Activity Feed under the Security header.

    The Project Activity Feed page displays.

1

In the Activity Feed, click the Filter by event(s) menu and check Atlas.

2

In the search box above the list, start typing auto-scaling.

In the right-hand side of the menu, all auto-scaling events display. Deselect any that you don't want to see. The feed list automatically updates with each change you make.

Important

In early August 2024, Atlas replaced legacy auto-scaling notification emails with configurable auto-scaling events. By default, Atlas continues to send all alert notifications to the project owners. You can customize your auto-scaling alert distribution to change alert recipients or a distribution method.

Auto-scaling activities are a subset of Atlas alerts. Each time Atlas triggers any of the auto-scaling events, you receive default Atlas alerts.

You can opt out of or change alert configuration for some or all auto-scaling events at a project level.

Important

Auto-scaling alerts apply to all clusters in a project. You cannot scope alerts to specific clusters. Alert notifications identify which cluster triggered the event by cluster name and ID.

To modify an alert configuration, in the Category section, select Atlas Auto Scaling and then select the Condition/Metric from the list. You can then modify roles for alert recipients, change a notification method, such as email or SMS, and add a notifier, such as Slack. To learn more, see Configure an Auto-Scaling Alert.

Note

This feature only applies to dedicated clusters in the M10 tier and upwards, and it is not supported for Flex clusters.

When auto-scaling is enabled on a cluster, Atlas automatically adjusts instance sizes and storage capacity based on workload.

If you use MongoDB & HashiCorp Terraform for your cluster instance sizing and storage configurations, you can specify effective fields for a subset of cluster sizing values. We recommend this approach, this way:

  • Spec attributes remain exactly as you defined in your Terraform configuration.

  • Default and auto-scaled values are available separately in effective specs (for example, effectiveElectableSpecs), and no resource drift occurs when Atlas auto-scales your cluster.

  • Your configuration stays clean and represents your intent, while effective specs show the reality of what Atlas has provisioned.

Effective fields ignore only changes to fields managed by specific types of auto-scaling. The following table details the fields ignored when effective fields and specific types of auto-scaling are enabled:

Type of Auto-Scaling Enabled
Specs
Ignored Fields
Node Type

Compute or Storage

electableSpecs

instanceSize, diskSizeGB, diskIOPS

Compute or Storage

readOnlySpecs

instanceSize, diskSizeGB, diskIOPS

Analytics

analyticsSpecs

instanceSize

You cannot use effective fields for search nodes.

To enable effective fields, include the following header in the API request:

--header "Use-Effective-Instance-Fields: true"

Set the use_effective_fields argument to true in your resource definition for the cluster as the following example shows:

resource "mongodbatlas_advanced_cluster" "this" {
project_id = mongodbatlas_project.this.id
name = var.cluster_name
cluster_type = var.cluster_type
use_effective_fields = true
replication_specs = var.replication_specs
tags = var.tags
}

To learn more, see Effective Fields Module Example.

Important

If you don't enable effective fields, you must manually configure a lifecycle.ignore_changes block to prevent resource drift when auto-scaling occurs. We do not recommend this approach . To learn more, see Auto-Scaling in the Terraform documentation.

Overall, effective fields behaviour falls into one of three scenarios:

Spec fields store your last node configuration, while effective fields show the values after latest auto-scaling event. Click to see a code example of this scenario.

Note

We recommend enabling effective fields as a best practice.

{
"replicationSpecs": [
{
"regionConfigs": [
{
"analyticsAutoScaling": {
"compute": {
"maxInstanceSize": "M30",
"minInstanceSize": "M10",
"enabled": true,
"scaleDownEnabled": true
},
"diskGB": {
"enabled": true
}
},
"autoScaling": {
"compute": {
"maxInstanceSize": "M30",
"minInstanceSize": "M10",
"enabled": true,
"scaleDownEnabled": true
},
"diskGB": {
"enabled": true
}
},
"effectiveAnalyticsSpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 0
},
"effectiveElectableSpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 3
},
"effectiveReadOnlySpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 0
},
"electableSpecs": {
"instanceSize": "M20",
"diskSizeGB": 50.0,
"nodeCount": 3
},
"priority": 7,
"providerName": "AWS",
"regionName": "US_EAST_1"
}
],
"zoneId": "6924a70c67695449ba5625ce",
"zoneName": "Zone 1"
}
]
}

Spec fields store your last node configuration, while effective fields show the values that Atlas stores internally. Click to see a code example of this scenario.

Note

We recommend enabling effective fields as a best practice.

{
"replicationSpecs": [
{
"regionConfigs": [
{
"effectiveAnalyticsSpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 0
},
"effectiveElectableSpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 3
},
"effectiveReadOnlySpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 0
},
"electableSpecs": {
"instanceSize": "M30",
"diskSizeGB": 100.0,
"nodeCount": 3
},
"priority": 7,
"providerName": "AWS",
"regionName": "US_EAST_1"
}
],
"zoneId": "6924a70c67695449ba5625ce",
"zoneName": "Zone 1"
}
]
}

Effective field values always match exactly those set in the corresponding specifications. Click to see a code example of this scenario.

Important

If you don't enable effective fields, you must manually configure a lifecycle.ignore_changes block to prevent resource drift when auto-scaling occurs. We do not recommend this approach . To learn more, see Auto-Scaling in the Terraform documentation.

{
"replicationSpecs": [
{
"regionConfigs": [
{
"analyticsAutoScaling": {
"compute": {
"maxInstanceSize": "M30",
"minInstanceSize": "M10",
"enabled": true,
"scaleDownEnabled": true
},
"diskGB": {
"enabled": true
}
},
"autoScaling": {
"compute": {
"maxInstanceSize": "M30",
"minInstanceSize": "M10",
"enabled": true,
"scaleDownEnabled": true
},
"diskGB": {
"enabled": true
}
},
"effectiveAnalyticsSpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 0
},
"effectiveElectableSpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 3
},
"effectiveReadOnlySpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 0
},
"analyticsSpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 0
},
"electableSpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 3
},
"readOnlySpecs": {
"instanceSize": "M30",
"diskIOPS": 3000,
"diskSizeGB": 100.0,
"ebsVolumeType": "STANDARD",
"nodeCount": 0
},
"priority": 7,
"providerName": "AWS",
"regionName": "US_EAST_1"
}
],
"zoneId": "6924a70c67695449ba5625ce",
"zoneName": "Zone 1"
}
]
}

If you enable effective fields, Atlas validates any new auto-scaling range against the cluster's current effective instance size. Atlas rejects a request that sets a range that doesn't contain the current effective instance size. This behavior applies to operational nodes and analytics nodes that use auto-scaling.

The request fails with a validation error in either of these cases:

  • The new minimum instance size is larger than the effective instance size.

  • The new maximum instance size is smaller than the effective instance size.

If the new range still contains the current effective instance size, you can change the bounds in a single request.

If the current effective instance size falls outside the new range, use the following procedure to move it into the new range before you change the bounds. If you update the instance size in the same request as the range change, Atlas doesn't apply the new instance size while auto-scaling is enabled with effective fields, so the request still fails.

1

Set compute.enabled to false.

2

Set instanceSize to the target value, then send the request.

3

Set compute.enabled to true.

4

Set minInstanceSize and maxInstanceSize to the new bounds, then send the request.

To adjust the auto-scaling range with Terraform, see Adjusting the Auto-Scaling Range with use_effective_fields in the Terraform provider documentation.

If you have any questions or concerns, contact support.