Skip to content

Automate AWS Lambda functions written in Go.

Notifications You must be signed in to change notification settings

cronchie/aws-lambda-go-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Lambda workflow for AWS

This is a basic template repo for deploying an AWS Lambda function in Go. It uses AWS Lambda, S3, and Cloudformation for automating storage and deployment of Go lambda functions.

You can either fork or use as template through Github.

Requirements

  • Go Lang
  • AWS CLI
  • AWS SAM CLI
  • Proper aws configure settings that will allow you to connect to AWS Lambda, S3, IAM, and CloudFormation

Getting started

First, make sure you have all the required CLI tools installed!

Begin by installing all go dependencies, run: make install

Once all dependencies are installed, you can start the API by running: make api. Visit http://127.0.0.1:3000/ in your browser to see your Lambda execution!

Finally, update main.go to fit your needs!

Included commands

Most of the commands have been extracted into a make file. To run any of the the following commands type make COMMAND_GOES_HERE

List of commands:

  • test - runs tests using go test
  • install - installs all go dependencies
  • main - builds the app for environment
  • lambda - builds app for environment AWS uses in the cloud
  • api - starts local API using Docker environment provided by SAM CLI (runs build)
  • package - uses sam-cli to create packaged.yaml file for CloudFormation. (Runs test and build before)
  • deploy - uses sam-cli to deploy the app on AWS (Runs test and package)
  • clean - cleans up app by removing old packaged.yaml file.

Deploying

In order to run the make deploy command successfully, you will need to supply the S3_BUCKET and STACK_NAME variables. Example usage below:

S3_BUCKET=YOUR_BUCKET_NAME STACK_NAME=YOUR_STACK_NAME make deploy

About

Automate AWS Lambda functions written in Go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 57.2%
  • Makefile 42.8%