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
Dedication

Creating and writing to a NoSQL database called DynamoDB using Python

Now that we understand how to create a table, add data, and query DynamoDB using the AWS Console, we will look at how we can do this using only Python code.

We recommend you use a Python Integrated development environment (IDE) such as Eclipse PyDev (http://www.pydev.org/download.html) or PyCharm (https://www.jetbrains.com/pycharm/). You do not need to use an IDE, but I would recommend that you do. If you really want to, you can use VI, for example, on Linux to actually edit your code. But using an IDE allows you, for example, to run debugging or set up unit testing locally and step through it, which makes it easier and more productive for development.

First create the table using Boto3 https://boto3.readthedocs.io/ in Python. Run the code in the following section in PyCharm or your favorite text editor...