DEV Community

Cover image for 4 ways of executing Lambda function via HTTP endpoint - a comparison
Pawel Zubkiewicz for AWS Community Builders

Posted on

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

Top comments (3)

Collapse
 
bigbeard profile image
ShinJustinHolly3317

is functionUrl good for management? cause it's domain is an uid. worried when lamda gets more and more, things will go messy

Collapse
 
abdennour profile image
abdennour

Let's add the support by "serverless-offline". So all of them are supported, excepted the last one ( the newest one) .

Collapse
 
mabsky profile image
Marcin Belczewski

If the ALB was internal could we say that an equivalent to Private endpoints was supported?