How to create a serverless REST API in Golang with AWS SST


The author shows how to create a serverless REST API with Golang on AWS using SST in this example.

Requirements (Golang, Node.JS)

Golang Project layout

An SST app is made up of two parts.

  1. stacks/ — Application Infrastructure
    The code that describes the infrastructure of your serverless app is placed in the stacks/ directory of your project. SST uses AWS CDK, to create the infrastructure. CDK doesn’t currently support Golang, so we’ll be using JavaScript here.
  2. services/ — Application Golang Code
    The code that’s run when your API is invoked is placed in the services/ directory of your project. We’ll be using Golang for this.