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)

Introduction to SAM

In this section, we will learn about SAM, which will help us build and deploy serverless functions:

  1. As mentioned earlier, SAM is about writing infrastructure as code. So, this is what a Lambda function would be described as in SAM:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
< Name of function >:
Type: AWS::Serverless::Function
Properties:
Handler: < index.handler >
Runtime: < runtime >
CodeUri: < URI of the bucket >
  1. In this block of code, we enter the details—the name of the function, and the URI of the S3 bucket where our code package is hosted. In the same way that we named the index and the handler in our Lambda settings, we need to enter those details here, too. The index.handler is the file in which our function code...