AWS Lambda Function URLs

Serverless most often refers to applications that don’t require you to provision or manage any servers. You can focus on your core product and business logic instead of responsibilities like operating system (OS) access control, OS patching, provisioning, right-sizing, scaling, and availability.

For more details on Serverless read below

AWS Serverless
Let’s see what does Serverless means!
The Serverless API

Earlier, we had to orchestrate a few services together to get an API up and running.

Several serverless functions implement the business logic in these apps. Using services like Amazon API Gateway and Application Load Balancer, each function is mapped to API endpoints, methods, and resources.

However, at times you need a simple HTTPS endpoint without having to configure or learn additional AWS services.

This is what AWS Lambda Function URLs allow you to do. It removes the dependency on API Gateway to expose HTTPS endpoints.

The Lambda function URL is unique globally and follows the following format:

Creating Lambda Function URLs using AWS console

  • First, we create a new Lambda Function
  • Next, we enable the function URL in Advanced Settings and select Auth Type as NONE
  • The boilerplate code is added and you will also see a new function URL generated which is a unique HTTPS endpoint
  • Now we try calling that URL from the postman and see the response below
Features available

Although it doesn’t support all the features that API Gateway does still it has some good features which can be useful

  • Allows AWS IAM Auth type
  • Enable CORS policy
  • Limit the HTTP methods
  • Header control
One of the most amazing feature

One feature that makes lambda function better than API Gateway is the timeout.

API Gateway has a limited 30seconds timeout and it might be a problem in some use cases.

However, Lambda function URLs don’t have any such limit but lambda, in general, has a timeout limit of 15 minutes which is more than enough.

You say — You need more time? — Well consider your architecture selection then 😉

For checking this, I updated the code with sleep for 1 min

Next, we try calling it from the postman again

Hope you liked this!
I will cover lambda function configuration using templating in upcoming blogs.

Cheers. 🍻

Tirthankar Kundu

Tirthankar Kundu