Create a GO Lambda Resource (2024/al2)

For this starter lambda, we create a Lambda Resource with the AWS Console.

Create a GO Lambda Resource in the AWS Console

  • Navigate to Service Lambda
  • Click “Create Function”

Lambda Console

Fill Form

  1. Choose author from scratch Choose this to code our own function
  2. Use gosimple as the function name. As we refer to this name when we deploy the code, this is the primary ID for the function. This name is unique within the account and region.
  3. This is the runtime. Choose the custom runtime with Amazon Linux 2 “Provide your own bootstrap…”. Scroll down to the bottom to see it.
  4. Use arm64 as architecture. We have to build the GO code for this target architecture.
  5. After filling all parameters, click the button Create Function

This creates the Lambda resource as well as a necessary IAM Role.

Custom runtime

As GO compiles into a static binary, there never was a “Runtime” for GO. With the new custom runtime, we can use the GO binary directly.

arm64 architecture

In most cases, this architecture is 20..30% faster

Change the handler

After the function is created, go to the Code tab and update the Runtime Settings

Lambda Console runtime settings

  1. Change the Handler name to bootstrap

Now we can code a function in the next chapter.

See also


See the full source on github.