4 ways of executing Lambda function via HTTP endpoint - a comparison

pzubkiewicz

Pawel Zubkiewicz

Posted on April 8, 2022

4 ways of executing Lambda function via HTTP endpoint - a comparison

Recent release of Lambda Function URLs is a great reason to write up a small summary describing possible ways of executing Lambda functions over HTTP endpoints.

There are four ways to invoke a Lambda function over HTTP:

  • API Gateway REST API
  • API Gateway HTTP API
  • Application Load Balancer
  • NEW Lambda Function URLs

Once again, AWS released new functionality, but it's up to us how, and more importantly, when we are going to use it. I hope this brief comparison will give you a head start, and make it easier to decided which option to select.

Comparison table

API GW REST API GW HTTP ALB Lambda URL
Authentication AWS_IAM, Custom authorizers AWS_IAM, Custom authorizers, JWT Social and corporate Identity Providers AWS_IAM
CORS CORS headers need to be provided in a response from Lambda function.
Custom domain names
Timeout [seconds] 29 30 60 default, max 4000 (The load balancer waits until your Lambda function responds or times out.) Equal to Lambda's timeout, max 900
Throttle quota 10,000 requests per second (RPS) per region shared among other resources 10,000 requests per second (RPS) per region shared among other resources
Pricing First 333 million = $3.5 First 300 million = $1.0 Complex to explain, cheaper than API GW over 500,000 requests per day Free, CloudFront proxying to Lambda URL = ~ $1.0 to $1.2
Payload size API GW 10 MB, but Lambda's is 6 MB. API GW 10 MB, but Lambda's is 6 MB 1 MB 6 MB
Validation
Data transformations
API Proxy
API caching
Private endpoints
Lambda alias support ✅ (via target groups)
Additional info Not serverless. AWS WAF supported Custom domain are not supported but can be mapped via CloudFront
Short summary Expensive but feature-rich Cheaper and faster. Probably you should use that in enterprise software. Makes sense for huge scale because of pricing. Free, simple and easy. Tiny projects & automations.

Disclaimer

This summary was created to the best of my knowledge. If you found some mistakes, or think that something important should be added that to it, please let me know.

Sources

💖 💪 🙅 🚩
pzubkiewicz
Pawel Zubkiewicz

Posted on April 8, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related