apex-go

Golang runtime for Apex/Lambda.

Github stars Tracking Chart

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 https://github.com/aws/aws-lambda-go instead of this package.

Features

Currently supports:

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

Example

package main

import (
  "encoding/json"
  "strings"

  "github.com/apex/go-apex"
)

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!"}}

Notes

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

Badges

Build Status
GoDoc



tjholowaychuk.com  · 
GitHub @tj  · 
Twitter @tjholowaychuk

Main metrics

Overview
Name With Ownerapex/apex-go
Primary LanguageGo
Program languageGo (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2016-01-27 00:08:36
Pushed At2018-01-18 00:00:47
Last Commit At2018-01-17 16:00:47
Release Count1
Last Release Namev1.0.0 (Posted on )
First Release Namev1.0.0 (Posted on )
用户参与
Stargazers Count292
Watchers Count25
Fork Count31
Commits Count73
Has Issues Enabled
Issues Count45
Issue Open Count15
Pull Requests Count19
Pull Requests Open Count1
Pull Requests Close Count4
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private