For nearly a decade I’ve been building APIs with API Gateway and Lambda. I was even fortunate enough to be part of the team that launched API Gatewa

So long API Gateway, and thanks for all the routes

submited by
Style Pass
2024-09-29 01:30:05

For nearly a decade I’ve been building APIs with API Gateway and Lambda. I was even fortunate enough to be part of the team that launched API Gateway back in 2015! It’s served me well and I’m sure I’ll use it again on future projects that require some of its more advanced features.

However, most of the time I just need a way to invoke a Lambda Function over HTTP with a custom domain name, and this is exactly what CloudFront + Lambda Function URL (CLFURL) enables.

Since launch, one of the biggest criticisms of API Gateway has been its pricing. One would expect that Lambda (the thing that’s doing the heavy lifting) would make up the majority of the cost, and not the thing that’s simply connecting it to a client. In reality, API Gateway (even the newer, cheaper HTTP API variant) often exceeds Lambda costs by more than 2x. Under similar conditions, CloudFront costs ~10% of what Lambda does.

Saying API Gateway is just a service that connects Lambda over HTTP is unfair. Yan Cui has an excellent comparison of the two approaches in his blog post When to use API Gateway vs. Lambda Function URLs. He covers many of the advanced features of API Gateway and concludes with a preference for API Gateway in most scenarios.

Leave a Comment