Running Serverless
Running Serverless
$34.99
Minimum price
$34.99
Suggested price
Running Serverless

This book is 100% complete

Completed on 2019-06-17

About the Book

This book will help you get started with AWS Lambda and the Serverless Application Model (SAM). Lambda is Amazon's engine for running event-driven functions, and SAM is an open-source toolkit that greatly simplifies configuring and deploying Lambda services. Together, they make it easy to create auto-scaling APIs and cloud services designed for serverless deployments. This book will help you:

  • Design applications that get the most out of serverless architectures
  • Create auto-scaling web APIs
  • Handle background tasks and messaging workflows
  • Set up a deployment pipeline for effective team collaboration
  • Test and troubleshoot code designed for AWS Lambda
  • Inspect and monitor serverless applications

This book is structured as a walk-through for building a practical application. We start from a simple static API and gradually grow it into an online image-resizing service, ready for millions of users, with all the supporting operational and infrastructural capabilities. The application closely resembles real-world systems that many of you will develop in your jobs. This will give you a good structure for your own work, and you will be able to almost copy parts to get a head start. As you discover how to create and deploy different parts of the application, you will also learn about key aspects of Lambda and related services, important tips, techniques and tools for running serverless. 

The tutorial evolved from dozens of conference workshops and code camps. My colleagues and I have used the exercises from this book to teach hundreds of developers about serverless architectures, improving the examples through feedback into a great way to gradually introduce important concepts.

About the Author

Gojko Adzic
Gojko Adzic

Gojko Adzic is a co-founder of MindMup, a mind-mapping collaboration tool which was one of the early adopters of AWS Lambda, and one of core contributors to Claudia.JS, a popular serverless deployment tool for JavaScript.


Gojko is a partner at Neuri Consulting LLP, winner of the 2016 European Software Testing Outstanding Achievement Award and the 2011 Most Influential Agile Testing Professional Award. Gojko's book Specification by Example won the Jolt Award for the best book of 2012, and his blog won the UK Agile Award for the best online publication in 2010. His other books include:

  • Humans vs Computers
  • Fifty Quick Ideas to Improve Your Tests
  • Fifty Quick Ideas to Improve Your User Stories
  • Impact Mapping
  • Specification by Example
  • Bridging the Communication Gap


To get in touch, write to gojko@neuri.co.uk or visit https://gojko.net.


Table of Contents

Copyright

About the author

Thanks to everyone who helped

Learn about updates

Introduction

1 Serverless in five minutes

The serverless pricing model

How request pricing affects deployment architecture

How request pricing affects security

How request pricing affects product decisions

Important AWS Lambda technical constraints

No session affinity

Non-deterministic latency

Limited execution time

No direct control over processing power

When to use Lambda

Interesting experiments

2 Set up tools for local development

Setting up prerequisites

Installing JavaScript tools

Installing the SAM command line tools

Configuring access credentials

Running with restricted user accounts

Using a profile

Interesting experiments

3 Create a web service

Infrastructure as code

The Lambda programming model

Deploying SAM applications

Step 1: Build

Step 2: Package

Step 3: Deploy

Inspecting a stack

Inspecting a stack from the command line

Interesting experiments

4 Development and troubleshooting

Retrieving execution logs

Retrieving logs from the command line

Searching logs

Logging incoming events

Simulating Lambda locally

Debugging functions

Validating templates

Working in a team

Setting up a deployment pipeline

Interesting experiments

5 Safe deployments

Function configurations

Versions and aliases

Gradual deployments

Adding deployment alerts

Interesting experiments

6 Handling HTTP requests

API Gateway events

Customising responses

Troubleshooting Gateway integrations

Processing request parameters

Using global settings to configure the implicit API

Creating parameterised CloudFormation stacks

Defining stack parameters

Referencing parameter values

Custom API domain names

Provide parameter values during deployment

Making stack parameters more user-friendly

Interesting experiments

7 Using external storage

Cloud storage options

Lambda access rights

Generating unique references

Using AWS resources from Lambda functions

Passing resource references to functions

Authorising access with IAM policies

Dealing with network timeouts

Interesting experiments

8 Cheaper, faster, serverless

Signing requests

Signed download URLs

Protecting S3 files

Interesting experiments

9 Handling platform events

Generating test events

Working with files

Working with asynchronous events

Avoiding circular references

Setting custom IAM policies

Handling asynchronous errors with dead letters

Conditional resources

Interesting experiments

10 Using application components

The AWS Serverless Application Repository

Lambda layers

Linking functions with layers

Invoking system utilities

Publishing to SAR

Interesting experiments

11 Managing sessions and user workflows

Moving session state out of Lambda functions

Resumable sessions

Minimise coordination

Moving static assets out of Lambda functions

Using S3 as a web server

Working with cross-origin resource sharing

Configuring S3 buckets for CORS

Configuring API Gateway for CORS

Uploading files to S3

Using custom resources to extend CloudFormation

Redeploying custom resources

Uploading files without the SAR component

Interesting experiments

12 Designing robust applications

API endpoints with path parameters

Designing with Ports and Adapters

Request processor

Infrastructure adapters

Lambda utility methods

Lambda entry code

Protecting against abuse

API throttling

Lambda throttling

Monitoring throttling

Interesting experiments

13 Deployment options

Think about jobs, not functions

One Lambda or many?

Aggregate processing data ownership

Aggregate code that needs to be consistent

Divide code around security boundaries

Divide code around CPU and memory needs

Divide tasks around timing restrictions

Sharing behaviour

Bundling shared libraries

Working with Lambda layers

Invoking one function from another

Sharing configuration

Interesting experiments

Where next?

Authors have earned$8,159,486writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. Free App. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets), MOBI (for Kindle) and in the free Leanpub App (for Mac, Windows, iOS and Android). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub