Am I missing something?
Am I missing something?
Don't compare the cost of Lambda per 100ms to the cost of a virtual machine per month since Lambda only charges as you use it. You'd have to have the CPU pegged at 100% usage to make that a fair comparison. Mind you even if you took the cost of Lambda per 100ms and multiplied that out for a monthly cost it's still about the same as an EC2 instance of the same capacity. (Eg. if I had a 1GB Lambda running for a total of 1 month compute time in the uswest2 region it'd cost $32).
Oh and the cost of API gateway is $3.50 per million requests and the bandwidth cost is completely negligible for us (we redirect to the resized image hosted on S3, fronted by cloudfront). We get 3 million image resizing requests a day. That's over 30 per second. It would take a lot of VMs to handle that (image resizing isn't trivial). Or we could just pay the whole $11.50.
I have to ask have you done the math? Lambda beats everything in cost except for some funky solutions using unreliable and less scalable lowendbox.com services.
Saying that you can run a 1GB lambda for 1 month nonstop for $32 does not impress me, and its kind of strange that it impresses you.
You could run a t2.micro with the same RAM for $6/mo if you reserve it for a year. And if you want to give that t2.micro a workload where it only has to respond to 1 request at a time, the same terms we are affording the lambda system, then it's no comparison.
Now, for responding to disparate requests every once in a while? Lambda is ideal. You can spin it up and you don't have to pay when it is isn't processing requests. But continuous requests? Hard no.
We can argue that the cost overhead at full load is worth it for the ability to "infinitely" scale with no effort. Alright, that's fine. But let's not pretend that it is "cheaper".
I still use dedicated hardware where I deem it appropriate, but the proof is in the pudding. For the right services, pulling them out into lambdas is proving to be a huge savings and performance boost for countless architectures.
I suppose that if while testing/starting out you use little bandwidth, and any additional bandwidth/users comes with income - it doesn't really matter that a chunk of that goes to AWS, and not to your business.
For those that actually do run non-trivial things on AWS (or other clouds) - do feel this is an accurate assessment? That bandwidth is still really expensive in the cloud?
Obviously lambda is a hammer, not a swiss army knife - you shouldn't shoehorn it into your app just because it's the new tech on the block. But the use case isn't niche at all.
We're using lambda for our service to ingest and process Hearthstone replays. An HTTP POST is sent to the API gateway, this triggers a lambda which parses a 0.5-2MB file, scrapes the data in it and stores data in the db + converts it to another format. The whole process takes 3-6 seconds. Lambda lets us easily scale to dozens of requests per second without having to worry about anything other than the DB server. Our frontend/app servers don't need to be touched.
The alternative would be to provision and manage a lot of EC2 instances to handle the load. We'd have to worry about provisioning them dynamically so that it's economically viable. We'd have to manage the load balancing ourselves. Lambda's been a huge time saver.
PS: Let it be known that Lambda only supports python 2.7, not python 3, and that really frickin sucks. Get your shit together, Amazon.
Node 4 support came, what, a month ago? It's pretty ridiculous.
I mean, that's reason enough. Python 2's string processing suuuuuuucks.
- https://docs.aws.amazon.com/lambda/latest/dg/vpc-rds.html
- https://docs.aws.amazon.com/lambda/latest/dg/access-control-...
But, if building on a very large scale with strict isolation requirements for your individual tasks it would make sense. Which is the niche I'm talking about; maybe it's just bigger than I assume it is.
I've had a number of startup ideas that went nowhere, and it would've been handy to test & demo them without springing for the full $17/month for an EC2 t2.micro instance. Usually they have some key aspect that's prevented me from running them on Lambda (eg. you can't exactly run a hacked Node.js binary on Lambda, and sending push notifications from it requires going through SNS and adopting its API), but if I could run arbitrary code & third-party packages and pay for only the computing time I use, it's an attractive proposition.
In general you use AWS for convenience anyway - if you're concerned about minimizing costs, you can sometimes get 10x price/performance ratios by moving to dedicated hosting.
google micro (1 cpu, 0.6GB ram): $0.006/hr
amazon nano (1 cpu, 0.5GB ram): $0.0065/hour
https://cloud.google.com/compute/pricing
https://aws.amazon.com/ec2/pricing/
in both cases, +disk, +traffic
Not exactly a crippling difference.My point is that when you compare apples to apples, it's really not all that different.
The micro went from 0.6G to 1G ram in the 't2' generation, and the nano fills the need people have for the old micro size. I use them for bastion/nat boxes :)
My feeling on this is that if the job is small enough and infrequent enough, I don't care about its impact on other services so I can run it anywhere (and it's effectively free in such a case), and if it's large enough and frequent enough then setting up for it in Lambda every time is wasteful and I probably want a system (even if a small one) dedicated to the job, for probably less money. There's probably a sweet spot in there somewhere...but, it's not high on my list of things to integrate into my infrastructure.
Unless your CPUs are constantly at 100% utilization, there is some slack in your infrastructure. Lambda you literally only pay for the compute time you actually use.
I migrated a smallish app to Lambda from EC2 and shaved my AWS bill from >$100/m to <$5/m.
Likewise, Lambda can execute events from SNS, Cloudwatch Events, Dynamo and a lot more, including the Amazon workflow system.