This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
开发者_高级运维 Improve this questionI'm building app on top of Amazon S3. How can I keep my S3 running under a set budget? Suppose I don't want unexpected traffic to over charge my AWS account. I'd rather it remain unavailable.
There is no way to set a budget for AWS.
But this feature is being requested very often, so probably one day it will be implemented.
https://forums.aws.amazon.com/thread.jspa?threadID=58127
AWS has announced the general availability of the functionality to Monitor Estimated Charges Using Billing Alerts via Amazon CloudWatch as of May 10, 2012 (which according to Daniel Lopez' answer [+1] has been available to AWS premium accounts since end of 2011 already):
We regularly estimate the total monthly charge for each AWS service that you use. When you enable monitoring for your account, we begin storing the estimates as CloudWatch metrics, where they'll remain available for the usual 14 day period. [...]
As outlined in the introductory blog post, You can start by using the billing alerts to let you know when your AWS bill will be higher than expected, see Monitor Your Estimated Charges Using Amazon CloudWatch for more details regarding this functionality.
This is already pretty useful for many basic needs, however, using the CloudWatch APIs to retrieve the stored metrics yourself (see the GetMetricStatistics API and Getting Statistics for a Metric for usage samples) actually allows you to drive arbitrary workflows and business logic based upon this data.
Regarding the latter, the scope of this offering is stressed as well though:
It is important to note that these are estimates, not predictions. The estimate approximates the cost of your AWS usage to date within the current billing cycle and will increase as you continue to consume resources. [...] It does not take trends or potential changes in your AWS usage pattern into account. [emphasis mine]
It seems there is still no solution provided by Amazon.
Take a look on Amazon Price-Watcher - Monitor your bill and auto-shut down your instances
So here is a basic script I've put together in Python which will sit and monitor the current price of your instance, and shut it down if it goes over a certain price-limit. (In the future, this can be changed to maybe throttling incoming bandwidth, or emailing the admin).
As of December 2011, if you have an AWS premium account you can use CloudWatch to monitor your estimated charges and if they go over a certain limit you can trigger different actions (such as shutting down the machine)
http://blog.bitnami.org/2011/12/monitor-your-estimated-aws-charges-with.html
精彩评论