699 points · by Metalnem · 6y ago · 397 comments
The lesson for me was don't trust your internally-hacked-together instance management system. The AWS interface to storage and instances is the base truth. And perhaps more importantly - I'm never getting into another startup which has financial risk like that without being a core expert in that risk/tech. I was focused on the business + client code - and had very little clue about the nitty-gritty of AWS. I should have been more involved with the code on that side, or at least the data-flow architecture.
In my experience AWS had very stringent limits on the amount of active instances of each type (starts around 10 for new accounts, 2 for the more expensive instances). It takes tickets to support then days of waiting to raise these limits.
That should have prevented your company from creating tens of instances, let alone hundreds, unless that's already your typical daily usage.
Does AWS update the billing console per day or upon request? I get charged per month, but I should add a habit in my habit tracker to learn more about my expenses...
Now I have learned, _always_ refresh the page and instance list prior to shutting anything down and _always_ confirm the shutdown was successful.
I set the lifecycle rule on all objects in the bucket, for as soon as possible (24 hours).
About 2 days later first thing in the morning I get a bunch of frantic messages from my manager that whatever script I was running, please stop it, before I'd even done anything for the day.
The lifecycle rule had taken effect near the end of the previous day, and he was just getting all the billing alerts from overnight, it was all done.
I read about glacier pricing, but didn't realize there was a lifecycle transfer fee per 1000 objects (I forget the exact price, maybe $0.05 per 1000 objects). That section was a lot further down the pricing page.
The bucket contained over 700 million small files.
I'd just blown $42,000.
That was over a month's AWS budget for us, in the end AWS gave us 10% back.
On the plus side, I didn't get in too much trouble, and given we'd break even in 4 years on S3 costs, upper management was gracious enough to see it as an unplanned investment.
TLDR: My company spent 42k for me to learn to read to the bottom of every AWS pricing page.
When there is a lot of money involved, people self-select into your company who view their jobs as basically to extract as much money as possible. This is especially true at the higher rungs. VP of marketing? Nope, professional money extractor. VP of engineering? Nope, professional money extractor too. You might think -- don't hire them. You can't! It doesn't matter how good the founders are, these people have spent their entire lifetimes perfecting their veneer. At that level they're the best in the world at it. Doesn't matter how good the founders are, they'll self select some of these people who will slip past their psychology. You might think -- fire them. Not so easy! They're good at embedding themselves into the org, they're good at slipping past the founders's radars, and they're high up so half their job is recruiting. They'll have dozens of cronies running around your company within a month or two.
https://news.ycombinator.com/item?id=18003253
I'm guessing something like the dynamic described here was involved.
The silver lining here may be that he outed himself (literally) before he was able to build an empire of such incompetence.
I would rather my whole system shut down and be unusable while I investigate vs. auto-scale and charge me a bill I can't cover.
However, searching around it seems like I can only get alerts when a $$$ threshold is passed, but AWS won't take any action to stop computing or anything. Please prove me wrong.
The counterargument is that you get a usage spike (which is often a good thing for a company), and AWS shuts down everything connected to your AWS account without warning.
I'm not necessarily sure that optional/non-default hard circuit breakers would be a bad thing. But it certainly appears not to be a heavily demanded customer feature and, honestly, if it's not the default--which is shouldn't be--I wonder how many customers, or at least customers the cloud providers really care about, would use them.
Sure, but most large companies (the kind which AWS gets a lot more revenue from and cares about a lot more) want the exact opposite. Most large companies have the extra cash to spend in the case that a runwaway auto-scale was in error, but on the other hand, completely shutting down operations whenever a traffic spike happens could resort in millions of lost revenue.
>However, searching around it seems like I can only get alerts when a $$$ threshold is passed, but AWS won't take any action to stop computing or anything. Please prove me wrong.
The general advice is to use the various kinds of usage alerts (billing alerts, forecasts, etc) to trigger Lambda functions that shut down your instances as you desire. It takes a little configuration on your part, but again, AWS intentionally errs on the side of not automatically turning off your instances unless you specifically tell it to.
For example, you shut down the ability to launch anything in a particular region easily - but assume you specifically want to exceed a default limit - you can call speak with your rep and have any of your limits set to whatever you want
The proposed solution is usually to setup billing alerts so you can detect the issue early and fix the problem in a way that makes sense.
I'd suggest further: new AWS (azure, etc) accounts should have billing alarms at $0, $10, $100, $1000, etc. by default on account creation. Users can delete if they don't want them or want something different. Getting an alert at $100 as it happens instead of getting a >$1k bill at the end of the month is a much better customer experience.
Depending on what you're doing, data loss might not be nearly as big of a threat as a massive bill.
I could also imagine it being configurable on a service by service basis to mitigate against the data loss downside - e.g. maybe you have a hard cap on your lambdas but not your database snapshots.
There may be a maximum threshold for this, though.
We also asked them to summarize what happened so we can think how to help other users not to make the same mistake in future.
I had a personal project, where I wanted to occasionally do short but highly parallel jobs. Once my scripts didn't close everything down correctly and a week later I had spent £600. That's a lot of money to me personally. I asked politely and it was never refunded.
So we switched to Google Cloud, which has a better UI for telling you how much you're about to spend. As we grew, we ended up spending way more money on GCP than we ever did on AWS.
- Not stopping AWS Glue with an insane amount of DPUs attached when not using it. Quote "I don't know I just attached as many as possible so it would go faster when I needed".
- Bad queueing of jobs that got deployed to production before the end of month reports came out. Ticket quote "sometimes jobs freeze and stall, can kick up 2 retry instances then fails", not a big problem in the middle of the month when there was only a job once a week. End of the month comes along and 100+ users auto upload data to be processed, spinning up 100+ c5.12xlarge instances which should finish in ~2 mins but hang overnight and spin up 2 retry instances each
- Bad queueing of data transfer (I am sensing a queueing problem) that led to high db usage so autoscaling r5.24xlarge (one big db for everything) to the limit of 40 instances
yeah I know I shouldn't +1 here but the upvote just didn't cut it.
I had a new employee dev include AWS creds in his github which was pulled instantly by hacker bots that launched a SHITTON of instances globally and cost $100K in a matter of hours...
It took my team like 6 hours to get it all under control... but AWS dropped all charges and we didnt have to pay any hosting costs for it....
So why didnt you work with AWS to kill such charges?
We've heard the horror stories from the Google data egress pricing "surprises" (like that GPT adventure game guy incurred a few month ago https://news.ycombinator.com/item?id=21739879).
We've heard the AWS and Azure horror stories.
It seems crazy that the only hope of correcting a mistaken overspend is a helpful support desk. The first one is free, right?
At least AWS does have such a support desk, Azure may have and with GCP you are better off just shuting down the company.
How about lesser providers such as Digital Ocean.
Let's say your code mistakenly provisions 1000 droplets instead of 100. Is this a scenario you can prevent at an admin level?
If their reputation isn’t enough to keep you from depending on GCP, their hiring of a lot of people from Oracle to beef up their sales staff should be a major warning.
[1] https://www.futurice.com/blog/mastering%20bigquery%20costs
Here is my referral code for the one I use:
https://crm.vpscheap.net/aff.php?aff=15
(I previously asked Dan, the mod here, if I can share in this way and he said it's okay. I don't have other affiliation with that company and have found it good.)
Claiming an unfounded dispute or transferring funds to a new company is fraud and you'll probably end up with both AWS and your bank coming after you for collections. With $80k on the line, its enough to file legal claims.
The best plan is to negotiate directly with AWS and ask for forgiveness and a payment plan. Do not try to run away from your financial obligations or you will make it far worse.
EDIT: you've rewritten your comment so this doesn't apply, but please don't recommend that people avoid their debts.
Yes in civil court. So, no don't pay it. This isn't London 1689. Debtors prisons do not exist.
"Claiming an unfounded dispute or transferring funds to a new company is fraud"
Explaining to the credit card company you were tricked or confused in this purchase is not fraud.
If cryptocurrency and smart contracts make sense to you, you might not be aware that forgiveness for human error really does happen in normal business.
What's wrong with this approach? It's not like they can collect on your personally, or go after the new company. (I wonder how they would even figure what legal entity is behind the new company/wesbite.)
https://www.nolo.com/legal-encyclopedia/personal-liability-p...
I don’t think those apply here. If by sheer accident you were hit with a giant AWS bill, and you were facing potentially having to shut down your company, and you conducted the maneuver that I described, what’s wrong with it? Your company was facing a life-or-death situation, and decided to be reborn.
Maybe there needs to be a form of corporate bankruptcy where the company can retain its core/key IP assets...
That is not a safe assumption to make, especially if you are deliberately (AKA fraudulently) dodging debts (IANAL).
Kind of makes me annoyed. I'm sure enterprises don't care/want unlimited. But solo practitioners, and people new to the platform would love a default e.g. $5K/month limit (or less).
Feels like these services just want people to "gotcha" into spending a bunch of money without simple safety nets.
PS - No, alerts do not accomplish the same thing, by the time you get the alert you could have spent tens of thousands.
I strongly suspect opaque pricing and high/nonexistent limits are more about getting large organizations to transition to the cloud seamlessly (i.e. not completely caring/realizing what they're getting into for any particular migration/deployment).
Tricking personal users into spending thousands by accident probably doesn't net much money compared to enterprise spend and runs the risk of alienating people who then can go into work and recommend against using a particular platform, having been burned by it on their personal accounts.
As a counter-datapoint, we accidentally left a Redshift cluster up idling for two weeks before we started getting alerts, and after numerous attempts have failed to get compensated in any way. The reasoning was that, well, it was what we requested and they had to allocate compute power to it (which we didn’t use).
All in all a very frustrating experience and it makes me fairly cynical of all these “I got my money back without problems!” comments.
(For what it’s worth, it was about $4k of costs which was a lot for us at the time)
Isn't AWS supposed to focus on the virtuous cycle of saving customers money (or at least reducing AWS supports need to write off customer mistakes)?
nobody wants to work on the billing code because it’s a mess and the penalty for a mistake is very high.
When I got charged an extremely large amount I was contacted by the customer support. They explained to me what happened (I had leaked a SECRET in my repo) and then got refunded the total amount.
It was quite an anecdotical experience because I wasn't expecting any of it as it was my mistake.
Someone had sent 70,000 emails (which is the default daily limit at my tier). Luckily only cost ~$8.
* Firebase Hosting with Firestore
* Cloudflare Workers Sites (using KV)
* Netlify (possibly w/ FaunaDB)
Done. For 98% of hobbyist projects, a single Vultr $5/month node is probably far more than enough. For 99%, three Vultr $10/month instances (web, DB, cache) is probably enough.
This by definition is deploying something you don't fully understand. If there's a problem in any of those templates you won't know. You won't really know if they even do what they say they do.
Using one to do something as important as this would be crazy.
Enterprise companies do not want infinite billing. They want fixed and reliable billing, more than anything else. With on-prem equipment they know a few years in advance what their expenditure is going to be at any time, and will have a budgeted amount over the top of that that they're on-board with. Bring the idea of autoscaling with limits, and they're very happy indeed, particularly with the idea of automatically scaling down.
> Azure has, built in, hard price/cost limits but doesn't allow the public to use them. For example if you have MSDN subscription credit you get a hard limit of up to $150/month, but you yourself cannot pick a bespoke limit to use the service more safely.
I would be willing to bet that that is something enterprise customers can get access too, particularly if their annual expenditure is high enough under normal operation. Microsoft knows the enterprise market very well, just like Oracle does, and like Amazon doesn't (historically speaking, at least).
Yes some of them have gift card programs already, but they probably don't want expanded regulations to contend with large sums of money.
Because it is just like that. Nine years ago Amazon said (about the same issue raised 14 years ago): "We’ve received similar requests from many of our customers and we definitely understand how important this is to your business; We hear you loud and clear. As it stands right now, we are planning to implement some features that are requested on this thread, though we don’t yet have a timeline to share." [0] In other words, they know people need it, but they prefer not to implement it.
[0] https://forums.aws.amazon.com/thread.jspa?threadID=58127
https://docs.microsoft.com/en-us/azure/governance/policy/tut...
They may not necessarily enforce spending limits - but it's possible to restrict provisioning of costly resources, or even whitelist resources that can be provisioned. Almost every Cloud Foundation project nowadays involves setting up these guard-rails.
There can be also many reasons for the budget overrun. It's not always a user error. It could be issue with the platform itself such as error in billing system or faulty autoscale logic. Or it could be caused by an external event, such as denial-of-service attack.
(Not sure how things work with the MSDN subscription credit, but at least you are not supposed to be running production workloads with those)
I ran into that issue when I wanted to play with AWS EC2 (few years ago, maybe it has changed since then, or maybe I didn't look hard enough). The free VMs were too slow to be usable. Considering my usage, I was unlikely to run into un-expected spendings, but I didn't want to take any risk. Can anyone recommend a similar service with a simpler customer interface where you can set up a simple safety spending limit?
Though amongst those service-types, I can't really recommend beyond the fact that linode & DO didn't give me any headaches for the one month I used them
Which means you won't learn AWS/Azure/etc instead, and they lose mind-share. This is actually an argument for why they SHOULD offer hard limits, not an argument against.
If their goal is to push startups/newbies/hobbyists to other platform, they're definitely on the right path. If the goal is to make their cloud services safe to learn/start using, then they could do much better.
My own mistakes are probably a greater risk, but still. Turn on that 2FA.
I do realize you can get closer to a hard limit while possibly exempting some services that would let you get over the limit--I suppose. Though then people would doubtless complain that the hard and fast limit is not, in fact, a hard and fast limit.
Intuitively, if you're capping out your S3 storage, the hard cutoff should look like "don't allow me to store any additional data".
If you're capping out retrieval, then "don't serve the data any more".
But if the data is stored, the clock keeps ticking until you delete it. If I have a TB of data stored, and I hit my $1K (or whatever limit) on April 15, the only way that I don't get hit with a >$1K bill for the month is if AWS deletes anything I have stored on the service. (Or at least holds it hostage until I pay up for the overage.)
No, for services like these it should cap at the cost of keeping the data indefinitely. If your budget limit for S3 was $1000 per month, and you tried to add an object which if not deleted would make you use $1010 next month (and every month after that), it should reject adding that object.
So now we've created a situation where everything's running fine, our bill is consistently $500/mo, I go casually turn on a $1k/mo spending limit... aaaaand suddenly everything starts failing in totally non-obvious ways.
That said, i am pretty sure the the TOS for MSDN funds say they are not be used for production systems.
Protip: Cloudtrails events are free the first time they're processed but are fairly expensive any subsequent times (i.e. two trails in the same region)
No hidden or unexpected costs.
No problem with scaling.
Stack Overflow runs on a single machine. Use a fast compiled language and a simple stack. No need in $6k/mo AWS bills which are the fashion these days.
I used to handle infra for a client a few years ago (the stack was built by another employee before I got there) and it always amazed me why these people pay $10-20K every month to AWS for their app with 500 users a day. Needless to say that AWS was also causing a lot of headaches with their instance management, network maintenance and service unavailability. I know cloud is cool, but business should probably think twice before going for it.
I think the problem is that companies want to appear bigger than they are. Saying they use AWS Cloud Stuff is a selling point to investors who have a distorted understanding of how scaling works...
The cloud service companies are marketed to entice people into buying services they don't need... yet/ever
You don't start out needing all the cloud fancy, and you can use "the cloud" just by using the parts you DO need.
The perverse side of it is, it costs to host the third party tooling as well, so cloud providers get more money from you setting up these tools so that you don't burn away all your money. However, they don't get more money from plugging the holes in their own tooling. So they have no incentive to fix it on their own.
Perverse incentives are why things are the way they are. This will only change when a large enough competitor defects.
Even working out what I was paying for proved really tricky. Turning it all off involved crawling through a bunch of opaque control panels.
I'm definitely never considering AWS again for a personal project. It's too dangerous. I'm not a company and I don't have corporate level budgets.
For non-technical guys, that is recursion. We were surprised to see $5000 bill in 10 days.
• Providers should let users set hard spending limits.
• Providers should offer a channel for investigating and waiving charges for honest mistakes if reported soon enough.
• Perhaps you should sign up with throwaway billing details so you can continue on another account till you sort it out. Morally and legally unsound but probably the better alternative to “killing your startup” I guess.
Still, it was pretty amazing that the query returned data within ~2 seconds.
So be careful kids. Public datasets don’t cost anything to store, but your cloud account is going to get pummeled for your exploratory data analysis and if you haven’t set any billing controls or alerts you’re in for a nasty surprise.
For personal hobby projects taking your chances on customer support goodwill in case you rack up a bill that would bankrupt you due to a wrong click seems kind of insane.
So what are good alternatives?
AWS, Azure, and GC are horrendously expensive for what they are. Especially for long-lived services. They do have a use case but 99% of businesses just do not need it.
(queue up the downvotes.)
The use case of delivering the service to a consumer of the service happens all the time, the use case of "oh, I didn't understand how this works and foot-gunned" is relatively rare.
AWS can eat that cost less expensively than maintaining the "if" statements inline on every request.
The most reliable code is code you don't write at all.
But it's less the CPU time, and more the complexity.
Let's say you have 4 instances, a database, some storage. Every minute you have those things costs you money.
And how do you "stop" the bill? Delete everything? What if you need that data? Does it make sense to delete all your backups from the past year over $1?
What would you do if you were manually monitoring this and taking action yourself? Can't you code an approximation of that for common scenarios?
There must be a middle ground between no help and "delete all your data when you go over your bill limit by $1".
I'm not sure why AWS would build something like this though themselves. To stop spending money EVERYTHING must be deleted (s3 / glacier / etc). If someone in accounting loads the wrong budget amount you lose all your data.
Amazon's focus seems more on making sure your data is kept and available.
Every workload is different and it's basically impossible for Amazon to set up a global cost limiting that would work for everyone. Trying to do so would just introduce a lot of new and non-obvious failure modes for a bunch of people.
It's like your landlord made a deal that if you couldn't pay your full rent any month, you could lose access to part of the property and he'd clean it out and re-rent it until next month. Except your landlord has no idea what your actual day-to-day life looks like. Some stuff is obviously no good to take away (you need the bathroom), some stuff is seemingly obviously no good (you need the kitchen... unless you always eat out). But what about that spare bedroom? Probably fine if you're just using it to store your recycling. Not fine if you're using it as a home office.
You need a understanding of the actual workload in order to figure out where costs could be reduced, and implementing rules or logic around a single workload limits everyone either to using that same thing, or not using the cost limiting.
- Some guy
(This actually happened to me a while back - a new employee created a 201st repo, which our private repo paid limit was 200, so the new repo was automatically made public and he had keys in his code. We had thousands of bitcoin mining instances launched using the keys and cost $75,000 super fast.
We caught it really quickly and AWS dropped the cost.
I once accidentally ran up a $2.8k bill and after explaining the situation they added a credit to my account to cancel out the charge at the end of the month. They obviously review it case by case but it’s definitely worth a shot.
Why not have a simple "budget" setting and have a setting what to discuss when it's exceeded. Options could be "shut down most recently started resources" or "shut down everything but don't delete any data", and "delete everything".
There are many Azure services that can’t be set to zero dollar billing without data loss, so I’m not sure how Azure could deal with those in a unified manner.
> Our next candidate is Azure Databricks. I have no idea what it is, and I don’t even care! All I know is that it’s pretty expensive, and that’s exactly what I need
But serious question: the original tweet is about a single instance that costs over 3 million dollars.
Is that genuinely a single physical instance? Like is it even technically possible to build a traditional single physical server of CPU+RAM+disk that costs that much?
Or, being a database server, is it some kind of clever abstraction that actually splits it up physically (e.g. relying on the fact that different database threads might be able to get away without sharing memory)?
The actual price comes from SQL server enterprise edition. A mysql db.r5.24xlarge multi-az prorated for 3 years is $219,551, which is ~$600 less per month than on-demand pricing. However, sqlserver-ee is 2,782,588. I believe this comes from per-core pricing for sql server. https://docs.google.com/spreadsheets/d/e/2PACX-1vQZT7wl1yvav...
Note - all prices were North Virginia, the original tweet was regarding servers in Bahrain.
I was vaguely aware that some server licensing is per-core, but I never realized it could add up to costs at that level.
Thanks!
Sorry I don't have more detailed data than that, but it certainly alerted me to the fact that you need to be really careful with these cloud services.
I think fundamentally small and middle-sized companies are building websites improperly (cargo culting companies that can afford million dollar mistakes), which surely exacerbates the situation.
But we used to be able to count on a person providing a service not to overcharge you because it was bad for business. When they didn't, it was news.