Running Serverless
$34.99
Minimum price
$34.99
Suggested price

Running Serverless

Introduction to AWS Lambda and the Serverless Application Model

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 partner at Neuri Consulting LLP. He He one of the 2019 AWS Serverless Heroes, the winner of the 2016 European Software Testing Outstanding Achievement Award, and the 2011 Agile Testing Days Most Influential 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.

Gojko is a frequent keynote speaker at leading software development conferences, and one of the authors of Narakeet and MindMup. As a consultant, Gojko helped companies around the world improve software delivery, from some of the largest financial institutions to small innovative startups.

To get in touch, write to gojko@neuri.com or visit http://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?

The Leanpub 60 Day 100% Happiness Guarantee

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

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. 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) and EPUB (for phones, tablets and Kindle). 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. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub