From Microservice To Serverless: Refactoring a Python microservice to a serverless functions

By Tom McLaughlin

Elevator Pitch

As workloads are moved from microservices to serverless engineers will need to understand the challenges serverless presents. We’ll walk through converting a microservice to serverless functions while discussing how to prepare for the task, the work involved, and how to ensure a reliable service.

Description

In this talk, I’ll walk through refactoring a simple microservice to an a serverless system on AWS. We’ll use an existing Python Flask web service and walk through refactoring it to AWS Lambda functions fronted by AWS API Gateway. This is a practical tech talk intended to demonstrate how to get started and accomplish this task.

I’ll show how:

  • How to decide what services should be refactored and which are better left alone.
  • How to initially move your microservice off of EC2 to API Gateway and Lambda with minimal code changes as you begin your refactor process.
  • How to further refactor your code for simpler operation once you’ve decided serverless is right for you.
  • Tools for deploying and managing your new service.
  • Issues that occur when your platform is able to immediately scale with your data; eg. thundering herd issues
  • How to build scalable systems in AWS that allow you to more easily scale services while keeping the need for refactoring low

People should come away with the confidence to re-engineer a microservice to run on AWS as a serverless system.

Notes

I’m an engineer for a startup that has chosen the serverless / FaaS route for engineering. This talk is based on my experience trying to engineer a simple service that should have taken a few days to solve which instead took far longer as many of my basic ideas on how to accomplish what seemed like a simple task needed to be thrown out and rethought in light of the challenges of this new style of engineering. I want to share this story and lessons learned because while adapting to it is tricky, I think this is a worthwhile style of engineering that will have long lasting effect on the technology world.