Building Serverless Applications with Python
Develop fast, scalable, and cost-effective web applications that are always available
Jalem Raj Rohit
BIRMINGHAM - MUMBAI
Building Serverless Applications with Python
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Merint Mathew
Acquisition Editor: Sandeep Mishra
Content Development Editor: Rohit Kumar Singh
Technical Editor: Ruvika Rao
Copy Editor: Safis Editing
Project Coordinator: Vaidehi Sawant
Proofreader: Safis Editing
Indexer: Priyanka Dhadke
Graphics: Jason Monteiro
Production Coordinator: Arvindkumar Gupta
First published: April 2018
Production reference: 1190418
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78728-867-6
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Jalem Raj Rohit is an IIT Jodhpur graduate with a keen interest in recommender systems, machine learning, and serverless and distributed systems. Raj currently works as a senior consultant data scienceand NLP at Episource, before which he worked at Zomato and Kayako. He contributes to open source projects in Python, Go, and Julia. He also speaks at tech conferences about serverless engineering and machine learning.
About the reviewer
Sanjeev Jaiswal is a computer graduate from CUSAT with 9 years of industrial experience. He basically uses Perl, Python, AWS, and GNU/Linux for his day-to-day activities. He is currently working on projects involving penetration testing, source code review, security design and implementations in AWS, and cloud security projects.
He is learning DevSecOps and Security Automation currently as well. Sanjeev loves teaching engineering students and IT professionals. He has been teaching in his leisure time for the last 8 years.
Special thanks to my wife, Shalini Jaiswal, for her unconditional support, and my friends Ranjan, Ritesh, Mickey, Shankar, and Santosh for their care and support all the time. Thanks to the people at Packt for the project and the opportunity to learn good stuff from skilled professionals through reviewing the project.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Table of Contents
Preface
Serverless engineering is a new domain of engineering that allows developers to write code and deploy infrastructures without having to worry about maintaining servers. This book explains the concepts of serverless engineering with Python examples on cloud architectures.
Who this book is for
This book is for Python developers who would like to learn about serverless architectures in cloud-based platforms such as Azure and Amazon Web Services (AWS). Python programming knowledge is assumed.
What this book covers
, The Serverless Paradigm, introduces the reader to the concepts of microservices and serverless architectures, and provides a clear understanding of the pros and cons.
, Building a Serverless Application in AWS, covers AWS Lambda and explains the concepts, workings, and the components involved in the tool in detail. It also explains the nuances involved in security, user controls, and versioning code inside Lambda.
, Setting Up Serverless Architectures, goes into further detail about the various triggers in AWS Lambda and how they integrate with the functions. The reader will learn what the event structure of each trigger will look like and how to modify the Lambda function with respect to the type of trigger used.
, Deploying Serverless APIs, explores the AWS API Gateway and also teaches the reader how to build efficient, scalable serverless APIs using the API Gateway and Lambda. It goes on to teach the reader how to improve the API by adding authorization and how to set up user-level controls such as throttling of requests.
, Logging and Monitoring, presents the concept of logging and monitoring in serverless applications. This is mostly still an unsolved problem in this domain. This chapter guides the reader through setting up logging and monitoring in the AWS environment with Python via custom metrics and logging. This chapter also goes into the details of best practices when it comes to logging and monitoring Lambda functions in Python.
, Scaling Up Serverless Architectures, discusses the practice of scaling up serverless architectures for large workloads using several third-party tools. This chapter also teaches the reader how to handle security, logging, and monitoring using the available Python modules.
, Security in AWS Lambda