Building Lambda functions with Go - Amazon Lambda
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Building Lambda functions with Go

Go is implemented differently than other managed runtimes. Because Go compiles natively to an executable binary, it doesn't require a dedicated language runtime. Use an OS-only runtime (the provided runtime family) to deploy Go functions to Lambda.

Go runtime support

The Go 1.x managed runtime for Lambda is deprecated. If you have functions that use the Go 1.x runtime, you must migrate your functions to provided.al2023 or provided.al2. The provided.al2023 and provided.al2 runtimes offer several advantages over go1.x, including support for the arm64 architecture (Amazon Graviton2 processors), smaller binaries, and slightly faster invoke times.

No code changes are required for this migration. The only required changes relate to how you build your deployment package and which runtime you use to create your function. For more information, see Migrating Amazon Lambda functions from the Go1.x runtime to the custom runtime on Amazon Linux 2 on the Amazon Compute Blog.

Name Identifier Operating system Deprecation date Block function create Block function update

OS-only Runtime


Amazon Linux 2023

OS-only Runtime


Amazon Linux 2

Tools and libraries

Lambda provides the following tools and libraries for the Go runtime:

For more information, see aws-lambda-go on GitHub.

Lambda provides the following sample applications for the Go runtime:

Sample Lambda applications in Go
  • go-al2 – A hello world function that returns the public IP address. This app uses the provided.al2 custom runtime.

  • blank-go – A Go function that shows the use of Lambda's Go libraries, logging, environment variables, and the Amazon SDK. This app uses the go1.x runtime.