History
SERVERLESS ARCHITECTURES WITH AWS
Topics
Copyright © 2018 Packt Publishing
Tutorials
Highlights
Offers & Deals
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.
Settings
Support
Sign Out
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, and its dealers and
distributors will be held liable for any damages caused or
alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark
information about all of the companies and products
men
e use of capitals.
However, Packt Publishing cannot guarantee the accuracy
n
e
thi b k b th
d i
one
oo
appropr
a
i t
ti
s
y
of this information.
Author: Mohit Gupta
Reviewer: Amandeep Singh
Managing Editor: Edwin Moses
Acquisitions Editor: Aditya Date
Production Editor: Nitesh Thakur
Editorial Board: David Barnes, Ewan Buckingham, Simon
Cox, Manasa Kumar, Alex Mazonowicz, Douglas Paterson,
Dominic Pereira, Shiny Poojary, Saman Siddiqui, Erol
Staveley, Ankita Thakur, and Mohita Vyas.
First Published: December 2018
Production Reference: 1211218
Published by Packt Publishing Ltd.
Livery Place, 35 Livery Street
Birmingham B3 2PB, UK
ISBN 9781789805024
Table of Contents
Table of Contents
Preface
AWS, Lambda, and Serverless
Applications
INTRODUCTION
THE SERVERLESS MODEL
BENEFITS OF THE SERVERLESS MODEL
INTRODUCTION TO AWS
AWS SERVERLESS ECOSYSTEM
AWS LAMBDA
SUPPORTED LANGUAGES
EXERCISE 1: RUNNING YOUR FIRST LAMBDA
FUNCTION
ACTIVITY 1: CREATING A NEW LAMBDA FUNCTION
THAT FINDS THE SQUARE ROOT OF THE
AVERAGE OF TWO INPUT NUMBERS
LIMITS OF AWS LAMBDA
AWS LAMBDA PRICING OVERVIEW
LAMBDA FREE TIER
ACTIVITY 2: CALCULATING THE TOTAL LAMBDA
COST
ADDITIONAL COSTS
SUMMARY
Working with the AWS Serverless
Platform
INTRODUCTION
AMAZON S3
KEY CHARACTERISTICS OF AMAZON S3
DEPLOYING A STATIC WEBSITE
EXERCISE 2: SETTING UP A STATIC WEBSITE WITH
AN S3 BUCKET USING A DOMAIN NAME IN ROUTE
53
ENABLING VERSIONING ON S3 BUCKET
S3 AND LAMBDA INTEGRATION
EXERCISE 3: WRITING A LAMBDA FUNCTION TO
READ A TEXT FILE
API GATEWAY
WHAT IS API GATEWAY?
API GATEWAY CONCEPTS
EXERCISE 4: CREATING A REST API AND
INTEGRATING IT WITH LAMBDA
OTHER NATIVE SERVICES
AMAZON SNS
AMAZON SQS
DYNAMODB
DYNAMODB STREAMS
DYNAMODB STREAMS INTEGRATION WITH
LAMBDA
EXERCISE 5: CREATING AN SNS TOPIC AND
SUBSCRIBING TO IT
EXERCISE 6: SNS INTEGRATION WITH S3 AND
LAMBDA
ACTIVITY 3: SETTING UP A MECHANISM TO GET
AN EMAIL ALERT WHEN AN OBJECT IS UPLOADED
INTO AN S3 BUCKET
SUMMARY
Building and Deploying a Media
Application
INTRODUCTION
DESIGNING A MEDIA WEB APPLICATION – FROM
TRADITIONAL TO SERVERLESS
BUILDING A SIMPLE SERVERLESS MEDIA WEB
APPLICATION
EXERCISE 7: BUILDING THE ROLE TO USE WITH
AN API
EXERCISE 8: CREATING AN API TO PUSH TO / GET
FROM AN S3 BUCKET