Book Image

Building Serverless Microservices in Python

By : Richard Takashi Freeman
Book Image

Building Serverless Microservices in Python

By: Richard Takashi Freeman

Overview of this book

Over the last few years, there has been a massive shift from monolithic architecture to microservices, thanks to their small and independent deployments that allow increased flexibility and agile delivery. Traditionally, virtual machines and containers were the principal mediums for deploying microservices, but they involved a lot of operational effort, configuration, and maintenance. More recently, serverless computing has gained popularity due to its built-in autoscaling abilities, reduced operational costs, and increased productivity. Building Serverless Microservices in Python begins by introducing you to serverless microservice structures. You will then learn how to create your first serverless data API and test your microservice. Moving on, you'll delve into data management and work with serverless patterns. Finally, the book introduces you to the importance of securing microservices. By the end of the book, you will have gained the skills you need to combine microservices with serverless computing, making their deployment much easier thanks to the cloud provider managing the servers and capacity planning.
Table of Contents (13 chapters)
Title Page

Testing Your Serverless Microservice

In the previous chapter, we created a fully functional serverless data API using API Gateway, Lambda, and DynamoDB, and we deployed it to the AWS CLI. The testing we showed was performed in the AWS Management Console and browser, which is fine for small amounts of simple code development as a proof of concept, but is not recommended for development or production systems.

It is much more efficient for a developer to first develop and test locally, and it is essential for continuous delivery to have automated tests. This chapter is all about testing.

Testing could easily cover a whole book, but we will keep things very practical and focused on testing your serverless code and the data API we deployed in Chapter 3, Deploying Your Serverless Stack. This will include unit testing, mocking, local debugging, integration testing, running the Lambda...