gmatht
gmatht

Reputation: 835

Limit AWS-Lambda budget

AWS Lambda seems nice for running stress tests.

I understand that is it should be able scale up to 1000 instances, and you are charged by 0.1s rather than per hour, which is handy for short stress tests. On the other hand, automatically scaling up gives you even less control over costs than EC2. For development having explicit budget would be nice. I understand that Amazon doesn't allow for explicit budgets since they can bring down websites in their moment of fame. However, for development having explicit budget would be nice.

Is there a workaround, or best practices for managing cost of AWS Lambda services during development? (For example, reducing the maximum time per request)

Upvotes: 3

Views: 2304

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269284

Yes, every AWS Lambda function has a setting for defining maximum duration. The default is a few seconds, but this can be expanded to 5 minutes.

AWS also has the ability to define Budgets and Forecasts so that you can set a budget per service, per AZ, per region, etc. You can then receive notifications at intervals such as 50%, 80% and 100% of budget.

You can also create Billing Alarms to be notified when expenditure passes a threshold.

AWS Lambda comes with a monthly free usage tier that includes 3 million seconds of time (at 128MB of memory).

It is unlikely that you will experience high bills with AWS Lambda it is being used for its correct purpose, which is running many small functions (rather than for long-running purposes, for which EC2 is better).

Upvotes: 6

Related Questions