/lambda-go-boilerplate

A boilerplate to implement a Lambda function with Go and aws-lambda-go

Primary LanguageGo

Lambda Go Boilerplate

This repo provides some utility an a boilerplate to implement a Lambda function with Go and aws-lambda-go

Build and deploy

As Go is a compiled language, build the application and create a Lambda deployment package. To do this, build a binary that runs on Linux, and zip it up into a deployment package.

$ GOOS=linux go build -o main
$ zip deployment.zip main conf.json

Env variavle

You should define an env varibale for your labmda function and call it dbCredentials and it should be KMS Encrypt of the follwoing json data

{"dbUser": "", "dbPassword": "", "dbHost": "", "dbName": ""}

You can use KmsEncrypt function in util package to do this

util.KmsEncrypt(`{"dbUser": "", "dbPassword": "", "dbHost": "", "dbName": ""}`)

Resources

Some useful resources

Lambda & Go

Announcing Go Support for AWS Lambda

The AWS SDK for Go provides APIs and utilities that developers can use to build Go applications that use AWS services

AWS SDK for Go

Libraries, samples and tools to help Go developers develop AWS Lambda functions.

How to build a Serverless API with Go and AWS Lambda

AWS Lambda Go Api Proxy

Go

Go by Example

Golang MySQL Tutorial

A MySQL-Driver for Go's database/sql package