[Tutorial] Serverless EBS with AWS


#1

After my previous tutorial on serverless webhooks I thought it may be worthwhile to create a tutorial on how to get started with AWS API Gateway, Lambda and DynamdoDB for use as a serverless EBS. As examples I’ve used Twitch’s Hello World and Animal Facts sample extensions and turned their locally hosted EBS services into serverless EBS running on AWS.

One common roadblock for smaller developers who are trying to get into Extension development is the initial cost of hosting a backend, and a serverless setup like this can significantly reduce overhead costs compared to a VPS or dedicated server while also allowing scalability (both up and down) depending on the needs as the extension grows/declines.

Topics Covered

  • DynamoDB - Database to store extension state for each channel.
  • IAM - Access rights management between services.
  • Lambda - Run Node.js/Go functions to act as a backend for the extensions.
  • API Gateway - Web accessible endpoint for the extension’s frontend to send requests to.

Things to keep in mind
This tutorial is just meant as a starting point to help you get going, it is not a definitive guide to any of the services used, nor is it designed as a “best practices” for deploying an extension to production, but hopefully it will be shed some light on what services are out there and how they can be used.

Also, I started this tutorial with no prior Golang knowledge, so while I could have simply re-written the Animal Facts EBS code in Node.js I decided to learn the basics of Go myself and work it to be suitable for Lambda. This may mean that my changes are a little rough, but they work and it’s a good example that Lambda has a wide range of languages available to be used.

If anyone is interested in more tutorials for various things, be it working with parts of the Twitch API, or more about different online services I try, I’d appreciate a follow on https://twitch.tv/thedist as I plan to start streaming step-by-step guides, as well as just poking around services and new features to try stuff out, in the future.

Finally, it is important to note that there are other companies that offer cloud services like this, such as Google Cloud and Microsoft Azure, but I’m familiar with AWS so that’s what I’ve used for this tutorial. Twitch also have an AWS Credits Program to help cover AWS costs of developing the proof-of-concept for an extension (Once you’re in production, the costs are on you), and Twitch is owned by Amazon so take that as you will.