Book Image

Building Serverless Applications with Python

Book Image

Building Serverless Applications with Python

Overview of this book

Serverless architectures allow you to build and run applications and services without having to manage the infrastructure. Many companies have adopted this architecture to save cost and improve scalability. This book will help you design serverless architectures for your applications with AWS and Python. The book is divided into three modules. The first module explains the fundamentals of serverless architecture and how AWS lambda functions work. In the next module, you will learn to build, release, and deploy your application to production. You will also learn to log and test your application. In the third module, we will take you through advanced topics such as building a serverless API for your application. You will also learn to troubleshoot and monitor your app and master AWS lambda programming concepts with API references. Moving on, you will also learn how to scale up serverless applications and handle distributed serverless systems in production. By the end of the book, you will be equipped with the knowledge required to build scalable and cost-efficient Python applications with a serverless framework.
Table of Contents (11 chapters)

SQS trigger

The AWS Simple Queue Service (SQS) is the AWS queue service. This service is similar to the queuing mechanisms that are used generally in software engineering. This enables us to add, store, and remove messages inside the queue.

We will learn how to trigger a Lambda function, depending on the number of messages in a SQS queue. This task will help you understand how serverless batch data architectures can be built and how to build one yourself.

We will do this by monitoring our SQS queue with a CloudWatch alarm and relaying the information to Lambda via an SNS topic, just like we did in the previous task.

So, in this section, we will do the following:

  1. Create an SQS queue
  2. Create an SNS topic
  3. Create a CloudWatch alarm for our SQS queue to monitor the number of messages in the queue
  4. Once the messages count reaches 5, the alarm will be set to ALERT and the corresponding...