DEV Community

Cover image for Introduction to Lambda Function URLs
Salam Shaik for AWS Community Builders

Posted on

Introduction to Lambda Function URLs

Hi everyone,

I have been using Lambda service for the last 3 years. Whenever I want a public URL to trigger the lambda function immediately I used to go to API Gateway.

There I have to do some steps like creating resources, and methods attaching lambda, deploying API, etc. Every time I used to wonder if there should be some easy way to do it

But never done any research on achieving this. Two days back doing some research for writing my next article I came across these Lambda Function URLs.

After getting to know about Lambda URLs, I literally felt like this

Okay. Enough of my story. Let’s dive into the topic

Lambda Function URLs:

If you want a public URL to directly call a Lambda function without using API Gateway, you can use Lambda function URLs. It will give a public HTTP URL. We can call this URL like normal URL we daily use in our lives

Creating a Lambda Function URL:

  • Visit the Lambda service from the AWS search

  • Click on the Create Lambda function. Give a name for the function and select Runtime. I am selecting Python 3.9 as my function runtime

  • Click on the Create Function button and wait for some time for the function to be created

  • It will come with the basic code like this

  • For testing, that code is enough. Now to create a public URL, Visit the configuration tab at the top of the Lambda code editor

  • From the side menu click on Function URL and click on the Create Function URL button

  • You can find different Auth types like below

  • AWS_IAM will allow permission granted users and roles to access the URL

  • NONE will give access to the public. Anybody can access the Lambda Function using the URL

  • From the Additional Settings, you can configure the CORS also

  • You can define the origin you want to allow and can add needed headers.

  • From the drop-down, you can select the methods you want for the function and click on save.

  • Once the Function URL is generated, you can find the details like below

  • You can copy the Function URL, put it in PostMan, and test it like the below

  • As I kept the Authe type as AWS_IAM, It’s giving forbidden as the response. Now I am changing it to NONE

  • After that, I tried again. Now I am getting the correct response.

Use cases:

  • We can use these Lambda Function URLs for webhooks

  • For a quick API, static websites, or single-page applications, these are helpful

  • For simple web applications, that don’t want to use API Gateway it is very helpful

  • For me for simply writing a function and testing it directly, I feel these function URLs are very helpful.

There are so many use cases for now I can only think of these


  • When you compare these Lambda Function URLs with API Gateway, these lack some security features API keys, Granular access control, etc.

  • For restricting the HTTP Methods we need to implement our own logic in the Lambda, by default these don't provide any HTTP method restriction

  • CORS configuration, if not configured correctly can lead to many security issues.

That’s all about Lambda Function URLs I got to know about in a little bit of time. If you know of any use cases I missed or any limitations you have feel free to comment. I am open to suggestions.

Thanks, everyone, Have a good day.

Top comments (4)

ranjancse profile image
Ranjan Dailata

A really great start.

Some suggestions if you don't mind. It's good to incorporate the key differences between the serverless technology usages, such as API Gateway REST, API Gateway HTTP, Function URL. Please refer to below blog post consists of a detailed table.

shaiksalam9182 profile image
Salam Shaik

Thanks for the suggestion. I will look into it.

usamanisarkhan profile image

Thank you for this one.

rdarrylr profile image
Darryl Ruggles

Lambda function URLs are really useful IMO. Thanks for sharing!