Reputation: 385
I am currently signed up to the free tier of AWS. I am enjoying experimenting with various services including those not affording by said free tier. Can AWS's enhanced budgets be used to stop services like EC2 instances if I accidentally spend too much? Or do they merely act as alerts?
Upvotes: 31
Views: 19459
Reputation: 29
You can use Lambda function to change state of your services (eg.EC2).
Upvotes: 1
Reputation: 2855
From what I could read, there is no way to set a hard limit.
What I did was set up the recommended budget notification and I'm also using a prepaid VISA card as a default payment method, so that I can be sure not to spend more than what I have on this card.
I think that's the safest option.
Upvotes: -1
Reputation: 549
Recently, Amazon has given "budget action" to carry out actions like stop services automatically if the budget has exceeded.
https://aws.amazon.com/about-aws/whats-new/2020/10/announcing-aws-budgets-actions/
Upvotes: 8
Reputation: 37460
There is no built-in way to terminate services based on budgets or billing alarms.
You can get notified automatically, but it is then up to you to determine how to handle it.
Would you really want AWS automatically terminating your production infrastructure because you went $1 over your estimated monthly spending?
Edit: There is now a way to monitor and alert on free tier usage, and when your predicted usage will exceed the free tier. See here for details. You could probably come up with a way to terminate infrastructure based on an alert using SNS & lambda.
Edit 2: In Oct. 2020, AWS released Budget Actions - the ability to trigger an action when a budget thresholds are reached. This should give you the ability to automate a response - you can shut down servers, change IAM permissions to prevent additional infrastructure from being created, etc.
Upvotes: 4
Reputation: 6786
There are several posts which looks it from different perspectives, such as this and this.
Having a cost cap might be a crucial requirement based on the usage, especially when considering how complex it is to set the things up properly and keeping everything secure on the cloud for an average user. At least we can expect to have a feature to switch on/off a cost-cap service, so a user can decide their own scenario easily.
Closest solution that I found is here:
It explains how to trigger AWS Lambda function to change IAM permission from EC2FullAccess
to EC2ReadOnly
when the budget exceeds the limit.
Upvotes: 7
Reputation: 13025
This is available for EC2, I don't think it is available for all of the AWS resources.
http://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/UsingAlarmActions.html
Hope it helps.
Upvotes: 8