go-lambda-invoke

command module
v0.0.0-...-a7fb43c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2019 License: MIT Imports: 2 Imported by: 0

README

go-lambda-invoke

Small package to allow you to invoke your Go AWS lambda locally.

This might be useful for:

  • You want to run an integration test, maybe in conjunction with LocalStack?
    • Unit testing is probably better in most cases
  • You want to validate your CI has built a valid linux binary of your application before deploying

I wrote a blog post about it here https://djhworld.github.io/post/2018/01/27/running-go-aws-lambda-functions-locally/

Installing

go get -u github.com/djhworld/go-lambda-invoke/golambdainvoke

Example usage

Run the example lambda toupperlambda.go on port 8001

_LAMBDA_SERVER_PORT=8001 go run ./toupperlambda.go

Then use this library in tests or wherever you need it, by calling

response, err := golambdainvoke.Run(Input{
    Port:    8001,
    Payload: "payload",
})

Note that Payload can be any structure that can be encoded by the encoding/json package. Your lambda function will need to use this structure in its type signature.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL