Three use cases for AWS Lambda Function URLs

Hudson Tavares
AWS Tip
Published in
2 min readApr 10, 2022

--

Amazon released on April 6 the support for Lambda Function URLs, which allows you to invoke lambdas directly via HTTPS requests.

Some users may feel confused about what it means as a new service capability compared with the longstanding API Gateway-based connectivity to lambdas. These are the points I envisage for my near-future consumption:

(1) Rapid prototyping with APIs
During prototyping, you often need server-side requests, and I always kept myself away from serverless infrastructure because of the number of boilerplate tasks (you need to set up an API Gateway, set its authentication mode, create the lambdas, and the routes for them).

With lambda function URLs, it feels as simple as setting up a Javascript function with a few panel parameters, which unleashes the potential of AWS for more uncomplicated prototypes.

Enable a checkbox is all you need, aside from the lambda code itself

P.S.: A lambda with Auth Type = NONE can be accessed by anyone, so we must be careful about who knows the lambda URL.

(2) Long running requests

Despite our best efforts, we may end up with some API requests taking longer (e.g., requests integrated with 3rd services). The possibility of, e.g., tokenizing the long-running tasks may not be in line with the business requirements.

All over the internet, every cloud developer applied the world’s creativity around the timeout between the lambdas, which can run up to 15 minutes, and the API Gateway, whose integrations cannot run longer than 30 seconds.

The 30 seconds cap does not apply for the lambda function URLs, which still provide full HTTPS support. Cloudfront distributions can distribute these addresses, which will make your myapi.com/my-long-running-function seamless for the users.

P.S.: Cloudfront distributions require Auth Type = NONE, which can become a security problem for authenticated APIs. I have some ideas for fixing this problem and will share them in future posts.

(3) Decoupling system-to-system calls

While it was already possible to do using Step Functions, SQS queues, and others, the combination of Lambda Function URLs sounds like a more straightforward integration for single-step microservices. No other infra is required — just the URL.

Combining Lambda Function URLs with the power of IAM for permissions handling will help secure and improve this typical kind of communication.

--

--

Occasional text writer, regular code writer; at times writing code in text spaces, and vice-versa.