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


In this chapter, we have discussed security and why it is important. Applying the OWASP security by design principles is a good first step to ensure that your serverless stack is secure. We then discussed IAM roles and gave an overview of policies, explaining how they are the key documents to ensure restricted access to AWS resources. We then looked at an overview of some of the security concepts and principles regarding securing your serverless microservices, specifically regarding Lambda, API Gateway, and DynamoDB.

We then built a scalable serverless microservice with a RESTful data API. We started by creating a DynamoDB table, then added data to it, and queried it, first using the AWS console manually, then using the Python Boto3 SDK. We then built a simple Lambda to parse the request URL parameters, query DynamoDB, and return the records as part of a response body....