Building a WebSocket API with AWS API Gateway v2, Golang, and CloudFormation

David Sandor
Build Succeeded
Published in
11 min readMay 4, 2022

--

A few years ago I wrote an article about creating a WebSocket API using AWS API Gateway as well. This version I hope to make things easier to use and faster as well.

In this article I will describe the following:

  • Methods for performing Authentication.
  • How to properly define a CloudFormation template.
  • Build a Request/Response API that does not use the Websocket Connect API to respond to a client, rather it will simply return the result.
  • Configure Logging / Debugging
  • Building the route handler Lambdas in Golang.

As always, if you are eager to view the code it is located here. Be sure to pay attention to the Default route and specifically the IntegrationResponse and RouteResponse. Read on if you want a detailed description of what these do.

--

--