mrserverless / musketeers-lambda-go-serverless

Serverless Lambda Go example using 3Musketeers and GitLab CI/CD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

musketeers-lambda-go-serverless

pipeline status

musketeers-lambda-go-sam is a sample project demonstrating using 3 Musketeers and GitLab CI/CD pipeline as code.

The Serverless Go project consist of AWS Lambda in Go binded to an API Gateway which returns the value of the environment variable ECHO_MESSAGE on a GET /echo request.

The 3 Musketeers pattern is being used to test, build, and deploy the Lambda function. Serverless is the chosen framework to handle AWS deployment. GitLab CI/CD then calls the exact same test, build and deploy commands.

Prerequisites

  • Docker
  • Compose
  • Make
  • AWS credentials in ~/.aws or environment variables (only for deploying to AWS)

For Windows users, PowerShell is recommended and make can be installed with scoop.

Usage

# create .env file based on envvars.yml with example values
$ make envfile
# install dependencies
$ make deps
# test
$ make test
# compile the go function and create package for serverless
$ make build pack
# deploy to aws
$ make deploy
# you should see something like:
#   endpoints:
#     GET - https://xyz.execute-api.ap-southeast-2.amazonaws.com/dev/echo
# request https://xyz.execute-api.ap-southeast-2.amazonaws.com/dev/echo
$ make echo
# "Thank you for using the 3 Musketeers!"
# remove the aws stack (api gateway, lambda)
$ make remove
# clean your folder and docker
$ make clean

About

Serverless Lambda Go example using 3Musketeers and GitLab CI/CD


Languages

Language:Makefile 69.7%Language:Go 30.3%