Skip to content

Serverless Lambda Go template project using 3Musketeers and GitLab CI/CD

License

Notifications You must be signed in to change notification settings

3musketeersio/musketeers-lambda-go-serverless

Repository files navigation

musketeers-lambda-go-serverless

License

pipeline status

travis 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
# 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 template project using 3Musketeers and GitLab CI/CD

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published