Running and testing AWS Lambda (Golang), API Gateway and DynamoDB in local environment using Terraform and LocalStack
Clone the repo:
git clone https://github.com/AntonioMartinezFernandez/golang-lambda-apigw-terraform-poc && cd golang-lambda-apigw-terraform-poc
Start Serverless Mode (it will provide an output with the lambda URL):
# You need to have Docker started and then execute the next command
just start-serverless
Run unit tests:
just test-unit
Run integration tests:
# You need to start serverless mode first in order to have deployed all the necessary components and then execute the next command
just test-integration
Start Independent Service Mode:
# You need to start serverless mode first in order to have deployed all the necessary components and then execute the next command
just start-local
ℹ️ The OpenAPI definition for this project is available here and is also available in the api\swagger.yaml
file of this repository.
- LocalStack API Gateway docs
- LocalStack Lambda docs
- Locally debug functions with AWS SAM
- Test AWS Lambdas on localhost
- Testing and Running Go API GW Lambdas Locally
- Serverless Applications with AWS Lambda and API Gateway
- DynamoDB Developer Guide
- DynamoDB examples using SDK for Go V2
- DynamoDB Table Terraform module
- DynamoDB Hash Key (Partition Key -PK-) and Range Key (Sort Key -SK-)
- Best practices for REST API design