AWS recently announced the general availability of Lambda Function URLs, a feature that lets developers directly configure a HTTPS endpoint and CORS headers for a Lambda function without provisioning other services.
With the new feature developers can avoid relying on the Amazon API Gateway or the Application Load Balancer to map a Lambda function to a HTTP call. Each function URL is globally unique and can be associated with a function’s alias or the function’s ARN, implicitly invoking the latest version. Alex Casalboni, principal developer advocate at AWS, explains the scenarios where to use the new feature helps:
Function URLs are best for use cases where you must implement a single-function microservice with a public endpoint that doesn’t require the advanced functionality of API Gateway, such as request validation, throttling, custom authorizers, custom domain names, usage plans, or caching. For example, when you are implementing webhook handlers, form validators, mobile payment processing, advertisement placement, machine learning inference, and so on.
Reviewing the announcement, AJ Stuyvenberg, serverless engineering lead at Datadog, adds:
They are useful in a couple of important cases - Mono-Lambda APIs, Service to Service communication, and lightweight webhooks. I think with a few iterations, Function URLs could get much better - and possibly be the default integration mechanism for HTTP-based Lambda invocation.
Source: https://aws.amazon.com/blogs/aws/announcing-aws-lambda-function-urls-built-in-https-endpoints-for-single-function-microservices/
The announcement triggered many comments on Hacker News and Reddit, with some users appreciating the simplicity of the solution and others missing the support of custom domains or highlighting limited authorization options. Ebi Mirsafian, senior infrastructure engineer at XING, thinks Lambda URLs are a "big enabler in the direction of 100% serverless" while Paul Zietsman, technical director at cloudandthings.io, comments:
I'm struggling to see why this exists, especially without an authorizer.
Amazon is not the only cloud provider supporting HTTP endpoints for serverless, with Google Cloud Functions and Azure Functions offering a similar feature. The new feature was not a complete surprise as it surfaced for a few hours last November in the AWS console, as reported among others by Scott Piper, cloud security consultant:
Looks like an ability to directly call Lambdas over the Internet without an API Gateway was just added to the SDK.
In a popular post, Rehan van der Merwe, senior cloud developer Swipe iX, recaps the benefits and pricing of the new feature:
Lambda URL - Pricing per million requests:
- Rest API (first 333 mil) = $3.5
- HTTP API (first 300 mil) = $1.0
- Lambda URL = Free
- CloudFront proxying to Lambda URL = ~ $1.0 to $1.2Lambda URL - Timeout in seconds:
- Rest API = 29
- HTTP API = 30
- Lambda URL = 900 (15min)
- CloudFront proxying to Lambda URL = 60 (by default)
Function URLs are available using the Lambda API and are supported in CloudFormation, AWS SAM and AWS CDK. They are included in Lambda’s request and duration pricing and are generally available today in all regions where Lambda is supported, except for the ones in China.