| You're over complicating things, I'm not assuming the existence of any magical function (other than the one Amazon already uses to calculate your bill). All I want is to be able to say "I do not, under any circumstances want to spend more than $X per month on this service." Amazon just needs to keep track of usage, and start rate limiting/returning 402s/blocking writes when the monthly limit is hit. If I estimate I'm going to need to spend $400 a month on my bill, then I might set a limit of $800, send me an email warning when I'm getting close, I'll go in and work out why I'm consuming much more than I expected. If I don't hit the "let me exceed my billing limit this month" button then stop the service. (but don't delete any data, I'm not sure why so many commenters seem to think this is a necessary step). Amazon is capable of calculating how much to charge you every month, so they're capable of doing this too. No fancy estimation required. ================================== So under your example - I upload my 10gb file, but some bug in my processing code means it doesn't get deleted and sits there for a while. Maybe I don't notice and it sits there for a few days instead of a few seconds, but Amazon sends me an automatic email because my usage this month so far is X% higher than the average of my last Y months. Ideal scenario: I go in, investigate, delete the file and temporarily increase my billing cap just for this month. Not great, but okay scenario: I don't notice the email, a few days later and I'm at ~2x my previous months bill (or whatever limit I've set up), amazon automatically starts returning 402s when I try to access my storage service. I am happy because this is still much better than getting a bill for 10x my previous amount at the end of the month instead. |
You're accruing costs even if you stop reading and writing. You're paying for the on-going storage, running of instances, etc.
What you're describing does not implement what you're describing it as.
E.g.,
It's the first day of the billing cycle, so our bill is effectively $0. So no limits in place on writing/rates/etc. We upload 100TB of data. No rate limiting or blocking because our current bill is under the $800 limit.
By about the 8th of the month, we've now hit the $800 limit you set. If you don't go hit the "let me exceed my billing limit" then you want Amazon to "stop the service".
You want:
This is not possible. There are two paths forward here: You're asking for Amazon to provide you services and just not bill you for them if you don't want to pay for them. This isn't going to happen.Alternatively, if you want them to not accept a write if it _would_ have led to you being over your budget, see my original comment about predicting the future.