AWS Introduces Lambda Function URLs to Simplify Serverless Deployments
AWS recently announced the general availability of Lambda function URLsa feature that allows developers to directly configure an 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 an HTTP call. Each function URL is globally unique and can be associated with a function alias or function ARN, implicitly calling the latest version. Alex CasalboniLeading developer advocate at AWS, explains the scenarios in which to use the new feature:
Function URLs are ideal for use cases where you need to implement a single-function microservice with a public endpoint that doesn’t require the advanced features of API Gateway, such as request validation, throttling, custom permissions, custom domain names, usage plans or caching. For example, when you implement webhook handlers, form validators, mobile payment processing, ad placement, machine learning inference, etc.
They are useful in a few important cases: Mono-Lambda APIs, service-to-service communication, and lightweight webhooks. I think with a few iterations, function URLs could be much better – and possibly be the default integration mechanism for HTTP-based Lambda invocation.
The announcement sparked a lot of comments on Hacker News and Reddit, with some users liking the simplicity of the solution and others missing support for custom domains or pointing out limited permission options. Ebi Mirsafian, Senior Infrastructure Engineer at XING, think Lambda URLs are a “great catalyst towards 100% serverless,” while Paul Zietsman, CTO at cloudandthings.io, comments:
I have a hard time understanding why this exists, especially without permission.
Amazon isn’t the only cloud provider supporting HTTP endpoints for serverless, with Google Cloud Features and Azure Functions offering similar functionality. The new feature wasn’t a total surprise as it popped up for a few hours last November in the AWS console, because reported among others by Scott Piper, cloud security consultant:
It looks like an ability to directly invoke Lambdas over the internet without an API Gateway has just been added to the SDK.
In a popular PublishRehan van der Merwe, Swipe iX Senior Cloud Developer, recaps the benefits and price of the new feature:
Lambda URLs – Pricing per million requests:
– Rest API (first 333 million) = $3.5
– HTTP API (first 300 million) = $1.0
– Lambda URL = Free
– CloudFront Proxy to Lambda URL = ~$1.0-$1.2
Lambda URL – Timeout in seconds:
– Rest API = 29
– HTTP API = 30
– Lambda URL = 900 (15min)
– CloudFront proxy to Lambda URL=60 (default)
Function URLs are available using the Lambda API and are supported in CloudFormation, AWS SAM, and AWS CDK. They are included in Lambda demand and duration pricing and are generally available today in all regions where Lambda is supported, except those in China.