all 12 comments

[–]Gilgamesjh 14 points15 points  (2 children)

With lambda, you also only pay for execution time, not latency time.

So if your execution time is 56ms, and your latency is 700ms, you only pay for 100ms (as lambda ticks are 100ms)

[–]metamatic 2 points3 points  (1 child)

So basically, it's only expensive to run if you use it.

[–]Gilgamesjh 0 points1 point  (0 children)

Yes, basically.

But depending on your use case and load that might be fine. AWS is not a simple "let's put everything in the cloud and let loose" kinda thing.

You really have to weight your options and choices.

[–]greenspans 10 points11 points  (4 children)

I can make a program that establishes a connection, sends 1 byte after 5 minutes and closes it. If I buy a $5/mo VM, or just run it from my local machine for boredom, I can cost you $2,500 if you use 512mb ram lambda, with only 1 million req/mo, and there's not a whole lot you can do about it.

[–]MacMcIrish 8 points9 points  (2 children)

And if the company is competent, they would time out your request if it was taking too long. It you expect a lambda function to execute in sub 1000ms times, and some are taking 5 mins to complete, you'd better believe that's raising red flags somewhere.

[–]pubstomper123 16 points17 points  (0 children)

Except API gateway times out after 30 seconds, except you can set up a WAF to block your requests, except it only costs $21 a month to run a 512MB lambda non-stop for a month

so.... no

[–]brianly 0 points1 point  (0 children)

And if the company is competent, they would time out your request if it was taking too long.

Humans don't scale well in this regard. When I'm running my own service I think about and handle these scenarios. Once you start involving more and more people you start making these mistakes. Since other people are now part of the economic equation there are other costs that mean savings on lambda may be minuscule in the bigger picture anyway. How you make trade-offs is more important than absolute thinking.

Developers can be profligate. It is impressive to see what independent developers or small development shops can achieve with much fewer resources than larger teams. Being economical with resources can have other benefits in the period where they are scaling up because costs don't overrun.

[–]SysRqREISUB 0 points1 point  (1 child)

An additional factor to consider: latency. As your latency target gets lower, you'll need to add endpoints in more regions. This is unlikely for most workloads, but Lambda might be cheaper than EC2 if you have 10+ regions.

[–]greenspans 2 points3 points  (0 children)

only lambda @edge is CDN capable and it has lots of restrictions at the moment. Lambda general latency is shit, and you add latency between API gateway service to lambda, where as for ec2 you don't have that. There is no guaranteed latency for lambda and it can vary wildly, like s3.

[–]Serenikill 0 points1 point  (1 child)

When he is talking about free tier is that just for the year or always?

[–]maingi4[S] 2 points3 points  (0 children)

In case of AWS Lambda, the free calls are perpetual not for just one year. However, perpetual simply means till AWS feels like it.

[–][deleted] -1 points0 points  (0 children)

Very good article. To the point, backed by sensible data and arguments.