2 minutes read

POSTED Apr, 2022 dot IN Serverless

Make it Available with AWS Lambda’s Function URLs

Oguzhan Ozdemir

Written by Oguzhan Ozdemir


Solutions Engineer @Thundra

linkedin-share
 X

The ease of use of the AWS Lambda service improves day by day. Having the option of directly opening your Lambda functions to the internet without having to deal with the extra services such as Amazon API Gateway or AWS Elastic Load Balancing has been wanted for a long time.

Today, AWS announced Lambda Function URLs to the public as a way to directly trigger Lambda functions using HTTPS endpoint. Thundra, as an AWS advanced technology partner and serving serverless users with observability tools, is very excited about this update and as usual, being one of the launch partners. Lambdas with the function URLs enabled will differ from API Gateway or other triggering methods in your distributed trace map on Thundra.

Configuration

Let’s talk about how you can enable function URLs on AWS and then see how Thundra behaves when a function is triggered that way.

There should be a new page on your function’s Configuration page that says Function URL. When we enter, it’ll list our existing function URLs if available. Let’s click Create and see our options.

image-Apr-04-2022-07-40-58-16-AM

When configuring a function URL, we first need to choose an authentication method. It’s pretty trivial what this option does. When it’s set to AWS_IAM, it’ll only let certain users and roles that have the proper permissions trigger this function via a function URL. When it’s set to NONE, as expected it will not make any authentication and the endpoint will be public.

Finally, when it’s created, it should give us an URL in the following format:

https://<url-id>.lambda-url.<region>.on.aws

Be careful about the permissions

There is one point to be careful about. Even if your function has no authentication configuration set up and has a public URL, it should still have the proper permissions to allow users to access it. This predefined permission is usually created automatically with the function URL itself. However, in any case, that doesn’t happen, you should set the following permissions to your function.

Experimenting in Thundra APM

Now that our function URL is ready, let’s see how Thundra handles this.

When we enter Thundra APM after instrumenting our function, we can see the invocations appear.

Let’s click on one of the invocations.

For this simple example, we’ve used a simple Hello World function and there is only one resource here. Let’s see what it looks like in the trace map.

It shows as you would expect; triggered via an HTTP endpoint.

Conclusion

We are very happy to see AWS Lambda getting better and creating solutions to make things easier for its users. The function URLs will be very helpful in certain situations where you don’t want to deal with other services to make your code available to the internet. Make sure to visit AWS Docs to see the full documentation on function URLs and its configuration options.