Resume an M0 cluster through the public API

Is it possible to resume an M0 cluster through the public API?

Hey @Federico_Ciuffardi,

Welcome to the MongoDB Community!

As per my knowledge, you cannot resume the M0 cluster using the MongoDB Atlas APIs. May I ask if is there any specific use case you’re trying to address?

However, Atlas automatically pauses M0 free clusters after 60 days of inactivity where there are zero connections to the cluster. You can resume the cluster at any time by connecting to that cluster using a MongoDB Driver, mongosh, or Data Explorer.

In case of any further questions feel free to reach out.

Regards,
Kushagra

Hi @Kushagra_Kesav, thank you!

I have several M0 clusters, some of them can be inactive for more than 60 days and pause. My idea is to be able to automate everything, so I would like to avoid having to manually resume those M0 clutters when I use them again.

Hey @Federico_Ciuffardi,

I hope you can achieve this by using a MongoDB driver and simply connecting to that cluster. In case you have any other concerns, please feel free to reach out.

Regards,
Kushagra

Well, I tried to connect to a paused M0 cluster using a MongoDB driver but this did not resume the cluster and failed with the following error:

Error: querySrv ENOTFOUND _mongodb._tcp.<...>.mongodb.net
    at QueryReqWrap.onresolve [as oncomplete] (node:internal/dns/promises:240:17) {
  errno: undefined,
  code: 'ENOTFOUND',
  syscall: 'querySrv',
  hostname: '_mongodb._tcp.<...>.mongodb.net'

From this stack overflow post javascript - Error: querySrv ENOTFOUND _mongodb._tcp.dbname.fzofb.mongodb.net - Stack Overflow it looks like this error is expected when the cluster is paused.

Hi @Federico_Ciuffardi,

Regarding the querySrv error, please check my reply on the following post.

You can also resume your cluster by interacting with the data using the Atlas UI Data Explorer.

If you’ve tried this and the cluster is resumed but you’re still getting a querySrv error than you may want to try with another DNS server.

Regards,
Jason

Hi @Jason_Tran,

I think the querySrv is related to the cluster being paused since it doesn’t happen with clusters that aren’t paused.

If I understand correctly Atlas UI Data Explorer is the web gui, was able to resume the cluster there but I was looking for a way to resume the cluster programmatically, preferably an API, so I could automate this.

Only for M10 and up.

1 Like

@Federico_Ciuffardi - Got it :slight_smile:

Since you won’t be able to use the Atlas Admin API to resume the free tier clusters (as Chris and Kushagra have mentioned), you could try automating / scheduling a connection to the M0 cluster’s you have running before the 60 days of inactivity to prevent it from being paused in the first place as a workaround possibly… I haven’t tested this myself but seems like it might work for your use case?

Let me know your thoughts.

2 Likes