The cloud might run me dry
March 18, 2010 6:43 PM   Subscribe

How can I ensure that my Amazon Web Services bill (specifically EC2 usage) doesn't exceed a certain dollar value? Is there a tool that will kill off my instance(s) at after a given amount of resources have been used?

Googling indicates there is no built in feature to do this.
posted by phrontist to Work & Money (10 answers total) 1 user marked this as a favorite
Link the account to a dedicated credit card with a fixed limit.
posted by bonobothegreat at 7:12 PM on March 18, 2010

bonobothegreat: have you tried that? In my experience (AWS admin for a largish startup. >$XXK monthly bills) they don't shut you off if the card payment doesn't work, they just contact you for alternate payment. Also, the billing is monthly so if you run over midmonth your card won't know about it....

To phrontist, I don't really know of any AWS-native tools. You could (and should!) route all of your AWS activity through your own monitoring tools. We use an AWS library and enforce all booting happens programatically and is logged and monitored daily. Helper sites like Rightscale may also be of assistance for this. I imagine the "spot instance" feature of EC2 is helpful here, although they won't term based on total accumulated cost but rather the hourly bid rate.

So what I'm saying is you'll probably need some outside help. I would recommend building a thin wrapper around ec2 calls and have that be a reaper for instances.
posted by neustile at 7:22 PM on March 18, 2010

Would that work? It seems like you accrue debt and it charges you periodically. Couldn't you still run up huge charges before the card was refused, which you'd still be responsible for?
posted by phrontist at 7:24 PM on March 18, 2010

I only plan to run a few instances - two or three at most. So I suppose I'll just have a process sit on one and kill the other (public facing) instances off if things get out of hand? Is there an API for resource consumption monitoring?
posted by phrontist at 7:26 PM on March 18, 2010

Not sure what could get out of hand if you only have two or three instances? For m1.smalls that's max $210/month or so. Are you running some other script that would boot new instances automatically? If not then I wouldn't think too hard about this. You can easily manage 2-3 instances manually.

re: API for resources; not really. You can call ec2-describe-instances as much as you want, which will include relatively parseable uptimes and machine types. boto or any other wrapper library will convert that metadata into something usable or graphable. Places like Rightscale (free for most use) give you run rate amounts and probably graph it, i haven't used it in awhile but it's worth checking out.
posted by neustile at 7:31 PM on March 18, 2010

Well, I'm concerned that, say, a sudden spike in traffic could bankrupt me.
posted by phrontist at 7:36 PM on March 18, 2010

OK, you're talking about EC2 bandwidth, not ec2 instance cost. Sorry i misunderstood. For bandwidth across all instances you'll need to use their Cloudwatch service. I don't know of any action-on-cloudwatch services out there, but I am sure some are coming. You may need to script this; either using cloudwatch directly or using a bandwidth monitor installed on the instance.
posted by neustile at 7:43 PM on March 18, 2010

Oh hey, I learned something new, Cloudwatch comes with Autoscaling -- i bet you could define a rule for in/out bandwidth over a certain amount to term instances.
posted by neustile at 7:44 PM on March 18, 2010

If you're serving content from EC2 (and not S3/Cloudfront) you could install some kind of bandwidth limiter on your webserver.
posted by bitterpants at 6:52 AM on March 19, 2010

Are you wedded to Amazon's system? has a pay up front system that pretty much guarantees you can't be overcharged.
posted by chairface at 11:05 PM on March 19, 2010

« Older Difficult Books   |   More Sex Story Sites Newer »
This thread is closed to new comments.