Hi there ,
I’m looking for a solution to change my cluster tier with Atlas API programmatically (I want to scale it down during nighttime and scale up during day time). Is there any way to do that?
I really appreciate any help you can provide.
Hi there ,
I’m looking for a solution to change my cluster tier with Atlas API programmatically (I want to scale it down during nighttime and scale up during day time). Is there any way to do that?
I really appreciate any help you can provide.
Hi there!
Since there wasn’t a reply to your message, I tried to run it by our documentation bot. Here is the response I got
Yes, you can programmatically change the cluster tier using the MongoDB Atlas API. This allows you to scale your cluster up or down based on your needs, such as scaling down during nighttime and scaling up during daytime.
To modify the cluster tier, you can use the Modify a Cluster endpoint of the Atlas API. Here is a general outline of how you can achieve this:
Here is an example using curl
:
curl -u "<publicKey>:<privateKey>" --digest \ -X PATCH "https://cloud.mongodb.com/api/atlas/v1.0/groups/<projectId>/clusters/<clusterName>" \ -H "Content-Type: application/json" \ -d '{ "providerSettings": { "instanceSizeName": "M10" // Change to your desired tier } }'
Replace <publicKey>
, <privateKey>
, <projectId>
, and <clusterName>
with your actual Atlas API credentials and cluster details. Adjust the instanceSizeName
to the desired tier.
Remember to handle any potential downtime or impact on your application when changing the cluster tier, as the cluster will reboot during the modification process.
Modify a Cluster
Docs
Configure Additional Settings
Docs
Create a Cluster
Docs
Topic | Replies | Views | Activity |
---|---|---|---|
I am geeting class: org.bson.codecs.configuration.CodecConfigurationException | 1 | 698 | May 2024 |
Atlas Admin API frequently returns NULL | 0 | 187 | Jul 2024 |
Triggers in Atlas Local | 0 | 271 | Jul 2024 |
403 Forbidden Error When Signing In to MongoDB | 2 | 133 | Dec 2024 |
Data Access and Security while configuring the application | 0 | 16 | Jan 29 |