New AWS Blueprint: Twirp (golang) API using CloudFront+API Gateway+Lambda

Similar to my NestJs AWS Blueprint from a few weeks ago, I’ve just released a new one – this time with the wonderful golang & RPC based Twirp and a few new additions.

Twirp is a golang based RPC framework built by Twitch. It has lots of the benefits of gRPC without the complexity. Check this post that covers the benefits, but in short it supports both protobuf and JSON and does not require a reverse proxy.

abp-sam-twirp brings all this goodness to API Gateway and Lambda, complete with CloudFront CDN and local simulation of DynamoDB and API Gateway+lambda. Here are a few of the other features:

  • Multi-stage CI/CD via CodePipeline. Convention over configuration, designed for teams and feature branches.
  • CloudFront -> API Gateway -> Lambda (running Twirp). JSON as and application/protobuf binary support
  • Straight forward environment variable configuration. Supports pulling from SSM when running in AWS.
  • Simulate API Gateway -> Lambda locally via sam local start-api. Talks to DynamoDB local via docker-compose.
  • Local dev server with hot-reload (quicker developer iterations than sam local).
  • DynamoDB local with tools to create table(s) and load data.
  • Realtime CodePipeline source pulls via GitHub webhook.
  • Example showcases exchanging FireBase auth token for platform API JWT Token. Platform token passing utilizes 2-part cookies.
  • Twirp and sam local working with go modules
  • Go module vendoring
  • Automatic route53 alias entries with stage prefix. Ex: test--api.exaple.com. HTTPS support via ACM.

Give it a try – would love to hear your thoughts on Twitter @rynop

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close