Skip to content

Go Powertools Lambda

Build Go Lambda functions with less boilerplate.

Go Powertools brings structured logging, OpenTelemetry tracing, CloudWatch metrics and HTTP routing to your AWS Lambda functions. Choose the independent Go modules your application needs.

Powertools for Go ram-gopher mascot

Powertools for AWS Lambda (Go) is an independent community Go port of Powertools for AWS Lambda (TypeScript). The source repository is rambow-cloud/powertools-lambda-go. See the compatibility boundaries and release notes. This is not an official AWS distribution.

Explore the documentation

Category What you can build
Getting started Install modules and build your first Go Lambda function.
Observability Add structured logging, OpenTelemetry tracing and CloudWatch metrics.
Event handlers Route HTTP APIs and resolve AppSync or Bedrock requests.
Data processing Process batches, parse and validate events, and handle duplicates.
Security and configuration Load parameters, mask sensitive data and sign AWS requests.
Release notes Read features and fixes in published versions.

Getting started

Install one utility to begin. For example, add structured logging:

CGO_ENABLED=0 go get github.com/rambow-cloud/powertools-lambda-go/logger@v1.2.0

Use Go 1.27 or newer, target arm64 or x86_64, and keep CGO disabled. Install the published modules using the module guide, which explains dependencies, imports, and the shared release version.

Your first Lambda

Write a typed handler with structured logging, then build a static Lambda executable.

Get started with Go Powertools

Route HTTP requests

Start with app.Get and app.Post. Read path parameters and JSON bodies, and return JSON responses.

Build a GET/POST handler

Install only what you use

Pick independent modules and add middleware or AWS integrations when your application needs them.

Choose your modules

Start with the essentials

Logger

Structured JSON logs with Lambda context, correlation IDs and configurable levels.

Write your first log

Tracer

Trace handlers and downstream calls with OpenTelemetry. Send spans to AWS X-Ray through a collector.

Add tracing

Metrics

Emit custom CloudWatch metrics with Embedded Metric Format, including cold-start metrics.

Record application metrics

Features

Choose the utilities your application needs. Each feature has its own Go module; adding one utility does not install the entire toolkit.

Utility What you can do
Tracer Trace handlers, operations, HTTP requests, and AWS SDK calls using OpenTelemetry. Export to AWS X-Ray through a collector.
Logger Write structured JSON logs with Lambda context, correlation IDs, configurable levels, and optional buffering.
Metrics Emit application metrics using CloudWatch Embedded Metric Format.
Event handlers Route HTTP requests, stream responses, and handle AppSync Events, AppSync GraphQL, and Bedrock Agent functions.
Parameters Retrieve and cache configuration from SSM, Secrets Manager, DynamoDB, and AppConfig.
Idempotency Protect operations from duplicate execution with DynamoDB or optional Redis/Valkey persistence.
Batch processing Process SQS, Kinesis, and DynamoDB Streams batches with partial failure handling.
JMESPath Query JSON documents and unwrap supported event envelopes.
Parser Parse event payloads into typed values and compose validation with your handler.
Validation Validate inputs and responses against JSON Schema.
Data Masking Erase or transform selected fields, with optional regex and KMS providers.
Kafka Decode Kafka events with JSON, Avro, or Protobuf payloads.
Signer Sign HTTP requests with AWS Signature Version 4.
Commons and Metadata Reuse runtime primitives and retrieve Lambda execution-environment metadata.

The manifest contains 31 modules, including 28 public modules. The legacy X-Ray SDK adapter is included in that count but is deprecated and frozen. Follow the OpenTelemetry migration guide for maintained X-Ray support.

Examples

Every main utility guide starts with maintained code and expected results. Browse the examples directory or choose a use case:

Project status

Read usage patterns for object lifetimes and environment variables for configuration. Utilities can be adopted independently, and maintained v1 APIs follow the version policy.

Use the TypeScript feature comparison, project progress and roadmap to distinguish implemented behavior from remaining compatibility and release work. Local acceptance records describe the scope of previous verification; they do not establish exhaustive parity or cloud acceptance.

Original contributions are licensed under MIT. Third-party content retains its original attribution. This project is not an official AWS distribution.

Common questions

What is Powertools Lambda Go?

Powertools Lambda Go is this community toolkit for AWS Lambda applications written in Go. It provides reusable modules for observability, HTTP APIs, configuration, idempotency, batch processing and validation. Install only the utilities you need; start with a complete Logger example or build a simple GET/POST API.

Is Powertools for Go an official AWS project?

No. This is an independent community implementation maintained in the rambow-cloud repository. It is a Go port of Powertools for AWS Lambda (TypeScript); the compatibility guide describes the maintained subset and differences.

Do I need to install every utility?

No. Install only the Go modules your application uses. Logger, Metrics, Tracer and the other utilities have independent import paths. The installation guide explains the shared release version and module dependencies.

How do I send Go Lambda traces to AWS X-Ray?

Use the maintained OpenTelemetry Tracer and send spans through an OTLP collector with an awsxray exporter. The legacy tracer/xray SDK adapter is deprecated and frozen; follow the migration guide.

Which Lambda runtime and architectures are supported?

Build static Go binaries with CGO_ENABLED=0 for Linux amd64 or arm64 and deploy them to AWS Lambda's provided.al2023 runtime. The first Lambda guide includes the handler and build commands.