Limit Serverless Spend

I was poking around the menus but couldn’t find anything about this - is there any way to shut off the service automatically after a certain spend threshold is reached? I’m running a small but public app and want to protect myself against denial-of-wallet attacks. I know you can set alerts if it reaches over $X but in case I’m not close to a computer or it’s the middle of the night, I don’t want to be out thousands or more dollars :upside_down_face:

1 Like

Hi @Timmy_Chen,

is there any way to shut off the service automatically after a certain spend threshold is reached?

There isn’t a feature to terminate serverless instances once a particular spend threshold is met.

If you’d like this type of feature to possibly be implemented in future, I would advise creating a feedback post in the MongoDB Feedback Engine in which you can describe the use case and others can vote for.

In saying so, I understand you’ve noted it’s a small app, would perhaps maybe a shared tier (M0 - M5) instance work better for your use case?


You can vote up this idea at serverless – MongoDB Feedback Engine. Copying my comment on that post here:

I accidentally wasted ~$150 in ~30 minutes because I used find_one (without an index) in a function that was running many instances in a high-performance computing environment. As someone using this for academic research as a student, not for business, it would have been really nice if I could have set some kind of cap or throttle. Had things gone slightly differently, this could have been much worse. I happened to notice the icon in the corner with the default alert of 1 million RPU/s. This led to me digging a bit deeper into the RPU pricing model trying to resolve the difference in how units are presented in the documentation vs. the monitoring page (M vs. MM, both referring to million apparently). This led me to do some rough calculations which quickly led me to stop the HPC runs that were causing the high usage. Had I left it running overnight instead of catching it after ~30 minutes, the situation would have been worse.