So recently I heard the news of a startup "Announce" getting a bill of $72k and almost bankrupting them in the process.
Story can be found here.
When I heard the news I was thinking about the same mistake that was made by me.
if
you are a programmer, chances are that you heard about good old
recursion. Recursion is a powerful strategy for solving problems, but
with great power comes of course great responsibilities. Missing an edge
case in a recursion can cause a huge conundrum and your resources
getting exploited pretty quickly, all thanks to the infinite recursion
that's been happening on the background.
Now in the cloud, recursion is little bit of the same line but brings forth another set of problems as well.
In
my case, I wrote a cloud function in firebase, that will update the
date of a set of documents inside a particular collection when data is
being **modified** in the same collection. Yes I know, dumb! I thought
of making the cloud function such that when new data is being **added**,
please update the date. But lucky me, instead of **adding**, I put
**update**.
And that cause recursion of it's own.
But I was
lucky enough, such that at the time of programming, in order to use a
cloud function I didn't needed a credit card (which is not the case as
of now!).
But this is just an absolute dump move, from a newbie
in cloud computing. Which indicates that even a newbie should be pretty
careful to use the cloud features with its upmost care.
Even experienced devs, accidentally introduced cloud recursion that gave them huge amount of bills.
So
next time you use a cloud service, make sure that you enable the option
to trigger an action while your bill reaches a certain amount. Most
popular cloud services like AWS, and GCP provides this feature.
Comments
Post a Comment