Skip to content
Switch branches/tags

Apex Golang

Golang runtime support for Apex/Lambda – providing handlers for Lambda sources, and runtime requirements such as implementing the Node.js shim stdio interface.

NOTE: apex v1.x supports native Go, so you should use instead of this package.


Currently supports:

  • Node.js shim
  • Environment variable population
  • Arbitrary JSON
  • CloudWatch Logs
  • Cognito
  • Kinesis
  • Dynamo
  • S3
  • SNS
  • SES


package main

import (


type message struct {
  Value string `json:"value"`

func main() {
  apex.HandleFunc(func(event json.RawMessage, ctx *apex.Context) (interface{}, error) {
    var m message

    if err := json.Unmarshal(event, &m); err != nil {
      return nil, err

    m.Value = strings.ToUpper(m.Value)

    return m, nil

Run the program:

echo '{"event":{"value":"Hello World!"}}' | go run main.go
{"value":{"value":"HELLO WORLD!"}}


Due to the Node.js shim required to run Go in Lambda, you must use stderr for logging – stdout is reserved for the shim.


Build Status GoDoc  ·  GitHub @tj  ·  Twitter @tjholowaychuk