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.
For Windows users, PowerShell is recommended and make can be installed with scoop.
# 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