This repository contains the code for the AWS Serverless API Architecture blog post.
- AWS Account
- AWS CLI
- Node 20.10.0
- Go 1.22.1
- Terraform 1.5.5
- Docker
This directory contains the code of a simple Fastify API service.
- install dependencies with
npm install
- for running locally run
npm run dev
- for building the project run
npm run build
- for starting the build run
npm run start
This directory contains the code of a simple Go Gin API service.
- for running locally run
go run main.go
- for building the project run
go build
- for starting the build run
./build/bootstrap
(if the build fail to run check the Makefile to adapt the build to your local machine)
- Under terraform folder rename .example.env to .env and fill in the required values.
- Run the following commands to deploy the infrastructure:
cd terraform
make create-all
- To deploy a new lambda version run:
make create-infra
Note: this will create 3 lambda:
- fastify-serverless-api-lambda (ZIP)
- go-serverless-api-lambda(ZIP)
- go-serverless-api-lambda-docker(docker)
- To destroy all infrastructure run:
make destroy-all
make create-all
: Create all infrastructuremake create-infra
: Create only the lambda infrastructure and update the api gatewaymake create-base
: Create the base infrastructure like terraform state resources and ecr for the docker lambdamake destroy-all
: Destroy all infrastructuremake destroy-infra
: Destroy only the lambda infrastructure and api gatewaymake destroy-base
: Destroy the base infrastructure