• Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created almost 9 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A multi-purpose tool for creating and managing AWS Lambda instances backed by arbitrary Go code

go-lambda aws Build Status

go-lambda is a multi-purpose tool for creating and managing AWS Lambda instances backed by arbitrary Go code. Since there is no official support of Go, this tool automatically generates a wrappig module in Python 2.7 which is able to pass data back and forth to the Go land. Check out an example function.

Features at glance

  • <10ms startup time, feels like native experience;
  • Resulting source.zip size is only 1.0M and in most cases has 2 files;
  • Easy to use: start writing your own lambdas in Go just in few minutes;
  • Relies on the official AWS SDK for Go while making all the requests, security is guaranteed;
  • No any boilerplate or "all-in-one" aims: the tool is made to do its job and nothing else. Yes, this is also a feature.

Installation

$ go get github.com/xlab/go-lambda

Keep in mind that if you are using something other than Linux x86_64, this tool will invoke the xlab/go-lambda Docker image in order to create cross-platform modules for AWS. Prepare your Docker setup beforehand.

Reference

Usage: go-lambda [OPTIONS] COMMAND [arg...]

A tiny AWS Lambda manager for Go deployments.

Options:
  --verbose=false            Run in verbose mode.
  -v, --version=false        Show the version and exit
  -r, --region="eu-west-1"   Specify the region.

Commands:
  list         Lists all defined AWS Lambda functions in the region.
  regions      Lists regions available for AWS Lambda service.
  info         Gets info about specific AWS Lambda function (specified by ID or NAME).
  source       Gets .zip of an AWS Lambda function source (specified by ID or NAME).
  delete       Deletes an AWS Lambda function (specified by ID or NAME).
  create       Creates an AWS Lambda function and uploads specified Go package as its source.
  update       Updates source of an AWS Lambda function (specified by ID or NAME).

Run 'go-lambda COMMAND --help' for more information on a command.

Examples

List available lambda functions in default region:

$ ./go-lambda list
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                           AWS LAMBDA FUNCTIONS: 2 (eu-west-1)                            โ”‚
โ”œโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ # โ”‚ NAME            โ”‚ UPDATED             โ”‚ SIZE     โ”‚ MEM LIMIT โ”‚ TIMEOUT โ”‚ DESCRIPTION โ”‚
โ”œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ 1 โ”‚ xxx-handler     โ”‚ 20 Dec 15 11:24 UTC โ”‚ 459.22K  โ”‚ 128M      โ”‚ 3s      โ”‚             โ”‚
โ”‚ 2 โ”‚ yyy-handler     โ”‚ 19 Dec 15 09:20 UTC โ”‚ 384.10K  โ”‚ 128M      โ”‚ 3s      โ”‚             โ”‚
โ•ฐโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Create a new lambda backed by Go code:

$ go-lambda create --role arn:aws:iam::account-id:role/lambda_basic_execution handler github.com/xlab/go-lambda/example

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                    AWS LAMBDA FUNCTION example-handler (eu-west-1)                    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ SHA256 Hash          โ”‚ rcUmH7y39GVzmnwEbeV4aCj9e4vkPdoZIF14oj+nyWM=                   โ”‚
โ”‚ Code Size            โ”‚ 1067.95K                                                       โ”‚
โ”‚ Description          โ”‚                                                                โ”‚
โ”‚ Amazon Resource Name โ”‚ arn:aws:lambda:eu-west-1:account-id:function:example-handler   โ”‚
โ”‚ Handler              โ”‚ example-handler.handler                                        โ”‚
โ”‚ Last Modified        โ”‚ 20 Dec 15 14:00 UTC                                            โ”‚
โ”‚ Memory Size          โ”‚ 128M                                                           โ”‚
โ”‚ Role                 โ”‚ arn:aws:iam::account-id:role/lambda_basic_execution            โ”‚
โ”‚ Runtime              โ”‚ python2.7                                                      โ”‚
โ”‚ Timeout              โ”‚ 3s                                                             โ”‚
โ”‚ Version              โ”‚ 25                                                             โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Now you can manage your function in the AWS dashboard, create API endpoints and event handlers.

Update existing function after fixing its Go code:

$ go-lambda update example-handler handler github.com/xlab/go-lambda/example

Roadmap

  • Replace JSON marshalling with something efficient (maybe);
  • Try to convince AWS staff that we need the native Go support in their cloud.

Please, spread the word about go-lambda โ€” let people use their favourite language for AWS Lambda. ๐Ÿป

go-lambda

Useful links

License

MIT

More Repositories

1

c-for-go

Automatic C-Go Bindings Generator for Go Programming Language
Go
1,384
star
2

android-go

The android-go project provides a platform for writing native Android apps in Go programming language.
Go
1,058
star
3

treeprint

Package treeprint provides a simple ASCII tree composing tool.
Go
387
star
4

pocketsphinx-go

CMU PocketSphinx for Golang, a lightweight speech recognition engine.
C
296
star
5

libvpx-go

Package vpx provides Go bindings for libvpx-1.6.0, the WebM Project VP8/VP9 codec implementation.
C
190
star
6

closer

Package closer ensures a clean exit for your Go app.
Go
132
star
7

at

AT is a framework written in Go for communication with AT-compatible devices like Huawei modems via serial port.
Go
113
star
8

matchbox-keyboard

A mirror of matchbox-keyboard tree + my patches
C
63
star
9

netsed

Mirror of http://silicone.homelinux.org/git/netsed.git/
C
59
star
10

structwalk

Battle-tested Go struct and map traversal utilities.
Go
31
star
11

portmidi

The package provides Go bindings for PortMIDI from the PortMedia set of libraries.
Go
26
star
12

teg-workshop

Go
25
star
13

tablewriter

The platform-independent fork of Go ASCII Table Generator, ported from the Ruby terminal-tables library.
Go
24
star
14

handysort

Alphanumeric string sorting algorithm implementation in Go
Go
24
star
15

vorbis-go

Package vorbis provides Go bindings for OggVorbis implementation by the Xiph.Org Foundation.
C
23
star
16

libpd-go

Package libpd provides an idiomatic Go-lang wrapper for Pure Data embeddable audio synthesis library.
Go
19
star
17

portaudio-go

Package portaudio provides Go bindings for PortAudio.
Go
18
star
18

ios-go

The iOS-go project provides a platform for writing native iOS apps in Go programming language.
Go
17
star
19

opus-go

Package opus provides Go bindings for Opus encoder/decoder reference implementation by Xiph.org
C
16
star
20

gitio

A git.io client for Go, also a CLI utility.
Go
13
star
21

pace

Package pace provides a threadsafe counter for measuring ticks in the specified timeframe.
Go
9
star
22

pkgconfig

A lightweight pkg-config(1) clone written in Go.
Go
7
star
23

alac-go

Package alac provides Go bindings for ALAC decoder (C version by David Hammerton) with community patches.
C
5
star
24

suplog

Supercharged Go logging based on Logrus
Go
5
star
25

etherman

Etherman is a CLI tool for managing and testing Solidity contract deployments, written in pure Go.
Go
5
star
26

midievent

Package midievent provides MIDI event type mappings for Go-lang.
Go
4
star
27

termtables

A fork of long-gone apcera/termtables, because I liked it.
Go
4
star
28

smsru

Go-lang API bindings for sms.ru
Go
3
star
29

qml-kit

qml-kit is a bootstrapping template for Go/QML projects.
Go
3
star
30

ziptools

Package ziptools provides functionality to search through USA zip codes and cities in extremely fast way.
Go
3
star
31

clipboard

Clipboard for Go (go-qml applications, uses Qt)
C++
2
star
32

tpmmgd

My coursework 2013 - Modeling DEDS with timed Petri nets
JavaScript
2
star
33

libafrodite

Code completion engine for Vala language
Vala
1
star
34

wp8sdk-installer

A try to install Windows Phone 8 SDK under Windows 7
Ruby
1
star
35

nl80211

Generating Go constants from a C header example project.
C
1
star
36

chunked

A PoC service for chunked and encrypted file uploads.
JavaScript
1
star
37

beam-o

Fire a beam to teleport your files onto servers in distant galaxies.
Go
1
star
38

tun

Tun is a tool that serves files from the specified directory or a web resource.
Go
1
star
39

linmath

Go port of linmath.h โ€” a small library for linear math as required for computer graphics.
Go
1
star
40

statsd_metrics

Common logic to report Go runtime and custom metrics to Telegraf/StatsD
Go
1
star
41

api

Package api is a helper that simplifies the process of REST APIs bindings creation in Go.
Go
1
star
42

invoker

Supercharged "exec.Cmd" helpers for asynchronous and thread-safe reading of StdOut and StdErr.
Go
1
star