DEV Community

Cover image for Let's say "Hello World" with Lambda Function URLs
Kosuke ENOMOTO for AWS Community Builders

Posted on

Let's say "Hello World" with Lambda Function URLs

TL;DR

Briefly tested Lambda Function URLs that AWS announced yesterday.

Introduction

Hi everyone! I am Kosuke who is working as a Product Owner based in Japan and one of the members of AWS Community Builders for Serverless.

My SNS are;

What is "Lambda Function URLs" ?

On Apr/06/2022 AWS announced a new feature that makes it easier to invoke functions through an HTTPS endpoint as a built-in capability of the AWS Lambda service. You can see details at AWS blog.
Announcing AWS Lambda Function URLs: Built-in HTTPS Endpoints for Single-Function Microservices

Let's say hello with Lambda Function URLs!!

I briefly tested that new feature within a half hours.
Here are the procedures.

  1. Log on to AWS Console and go on to AWS Lambda > Functions.
  2. Click "create function" on the upper right. 1st step: Click create function
  3. Choose "Author from scratch" 2nd step: choose how to create the function
  4. name the Function name(helloWorldUrlTest), choose Runtime(Node.js 14.x) and Architecture(x86_64). Permission can stay as default(as chosen Create a new role with basic Lambda permissions). 3rd step: basic settings
  5. Open Advanced settings, check Enable function URL and you will see some more settings, Auth type to NONE and check Configure cross-origin resource sharing(CORS). 4th step: Advanced settings
  6. Click Create function button on the bottom.
  7. Here you created the function! 5th step: Function created
  8. You can see the function URL. Click it and you will see "Hello from Lambda!" That's it! 6th step: test

Closing remarks

It took only just a few minutes to see "Hello world" in the browser.
The codes just returns simple JSON including HTTP status code 200 and body "Hello from Lambda!".

{
  "statusCode": 200,
  "body": "\"Hello from Lambda!\""
}
Enter fullscreen mode Exit fullscreen mode

The AWS blog offers sample codes to deep dive into the function URLs feature, so you just build and test it!

Thank you very much for reading! See you next time!!

Oldest comments (0)