This book is 58% complete

Last updated on 2016-09-06

About the Book

The implications of choosing a serverless architecture are large and varied. Therefore, the content of this book should appeal to a broad range of people interested in architecture, design, development, deployment, testing, and maintenance of systems.

If you’re already a fan of microservices (versus monolith or n-tier) systems, this book will provide you with ammunition to lobby for their increased adoption amongst your peers and coworkers, along with plenty of practical advice and concrete examples to help you figure out what you’re doing.

While my primary recurring example is of a greenfield application that has been designed from the start with this approach, you should find the information herein to also apply to decomposition of existing, monolithic or dysfunctional systems as well. There are also plenty of real-life examples including case studies.

While there are a handful of viable technologies that may be used to achieve a serverless architecture, this book focuses on Amazon Web Services. In my opinion, their revolutionary Lambda product is the world’s first viable attempt to provide infinitely scalable computation-on-demand. In their words, it gives you the ability to run code, not servers.

Guide to Readers

This book has four main parts. I’ve done my best to make sure it will be a delight to read straight through chapter by chapter. At the same time, the book is apportioned into major parts that I hope will make it useful as a reference companion.

The first part entitled The Story encompasses Chapters 1 thru 5 and is an introduction to the main concepts and technology involved in building serverless applications using microservices with Amazon Web Services.

The second part called The Case Study is the story of our case study and source of example code, a tech startup called FoodButton. Throughout the book, we have made an effort to relate the story of our case study in vivid detail, including context for the architectural decisions. We feel that the best way to learn about how to design applications is by understanding the context of the decisions made while building and evolving actual systems.

The third part is The Patterns and it is where we list out the patterns that we find relevant to the building and integrating of microservices. Some of the patterns are quite large in scope, especially the ones pertaining to architectural styles.

The Services provides a high-level reference guide to the AWS products most relevant to serverless microservices design. This part does not go in-depth because we understand more than anyone else that the best place to get that information is online.”

Table of Contents (Jan 4, 2015)


Who Should Read This Book

Guide to Readers


Debt of Gratitude



The Story

1. Introduction

1.1 Benefits of the Approach

1.2 Historical Context

1.3 Cost Considerations

1.4 Other Platforms

1.5 Prerequisites

2. Microservices

2.1 Characteristics

2.2 Versus Layered Architecture

2.3 Microservices ala Fred George

2.4 Drawbacks

3. AWS Fundamentals

3.1 AWS Command-Line Interface

3.2 SDK Libraries

3.3 Configuration Information

3.4 Credentials

3.5 Signed Requests

3.6 Retry Logic

3.7 Regions

3.8 Service Limits

4. Serverless Framework

4.1 Summary

4.2 Deployment

4.3 Configuration

4.4 Installing SLS

4.5 Creating a Project

5. Saws

5.1 Installation

5.2 Usage

5.3 DynamoDB

5.4 SNS (Simple Notification Service)

The Case Study

6. FoodButton

6.1 Functionality

6.2 A Living System

6.3 Sample Code

6.4 Systems

6.5 High-Level Requirements

6.6 Collaboration of Microservices

6.7 Implementation Using AWS

7. Waiter

7.1 API Gateway Setup

7.2 Lambda Handler Function

8. StripeCashier

9. FeedbackHistorian

10. RestaurantPicker

11. RestaurantNotifier

12. DataWarehouseClerk

The Patterns

13. Architectural Patterns

13.1 Asynchronous Messaging

13.2 Big Ball of Mud

13.3 Command and Query Responsibility Segregation (CQRS)

13.4 Event-Driven Architecture

13.5 Orchestrated Workflow

13.6 Pipes and Filters

14. Microservice Roles

14.1 Message Originator

14.2 Content Enricher

14.3 Event Mediator

14.4 Event Processor

14.5 Coexistant Versions

14.6 Fanout

14.7 Async Waterfall (with optional Fanout)

14.8 Need Solution

14.9 Transformer

14.10 Worker

15. Integration Styles

15.1 File Transfer

15.2 Shared Database

15.3 Remote Procedure Invocation

15.4 Messaging

16. Messaging Systems

16.1 Message Channel

16.2 Message

16.3 Message Router

16.4 Message Translator

16.5 Message Endpoint

17. Messaging Channels

17.1 Point-to-Point Channel

17.2 Publish-Subscribe Channel

17.3 Datatype Channel

17.4 Invalid Message Channel

17.5 Dead Letter Channel

17.6 Guaranteed Delivery

17.7 Channel Adapter

17.8 Messaging Bridge

17.9 Message Bus

18. Message Construction

18.1 Command Message

18.2 Document Message

18.3 Event Message

18.4 Request-Reply

18.5 Return Address

18.6 Correlation Identifier

18.7 Message Sequence

18.8 Message Expiration

18.9 Format Indicator

19. Message Routing

19.1 Content-Based Router

19.2 Message Filter

19.3 Dynamic Router

19.4 Recipient List

19.5 Splitter

19.6 Aggregator

19.7 Resequencer

19.8 Composed Message Processor

19.9 Scatter-Gather

19.10 Routing Slip

19.11 Process Manager

19.12 Queue Coupling

19.13 Message Broker

20. Message Transformation

20.1 Envelope Wrapper

20.2 Content Enricher

20.3 Content Filter

20.4 Claim Check

20.5 Normalizer

20.6 Canonical Data Model

21. Messaging Endpoints

21.1 Messaging Gateway

21.2 Messaging Mapper

21.3 Transactional Client

21.4 Polling Consumer

21.5 Event-Driven Consumer

21.6 Competing Consumers

21.7 Message Dispatcher

21.8 Selective Consumer

21.9 Durable Subscriber

21.10 Idempotent Receiver

21.11 Service Activator

22. System Management

22.1 Control Bus

22.2 Detour

22.3 Wire Tap

22.4 Message History

22.5 Message Store

22.6 Smart Proxy

22.7 Test Message

22.8 Channel Purger

The Services

23. API Gateway

24. Lambda

25. Identity and Access Management (IAM)

26. DynamoDB

26.1 Concepts

27. Cognito

27.1 Initial Setup

27.2 Using Cognito in Client Code

28. Simple Notification Service (SNS)

28.1 Example Uses

28.2 Benefits

28.3 Basics

29. Simple Queue Service (SQS)

29.1 Architectural Overview

29.2 SQS Features

29.3 Properties of Distributed Queues

29.4 How is Amazon SNS different from Amazon SQS?

30. S3 (Simple Storage Service)

30.1 Buckets

30.2 Static Website Hosting

30.3 Events

30.4 Storage Classes

31. ElastiCache

31.1 Memcached

31.2 Redis

31.3 Features

32. Redshift

33. Simple Workflow (SWF)

34. CloudFront

35. CloudWatch

36. Elastic Beanstalk (EB)

37. Virtual Private Cloud (VPC)


Getting Started with AWS

Setup an AWS Account

Create An Administrative IAM User

Store credentials locally

Attach AdministratorAccess policy




About the Author

Obie Fernandez
Obie Fernandez

The "one and only" Obie Fernandez is an avid writer and technology enthusiast. His latest book, Serverless, describes how to fully leverage Amazon Web Services to achieve modern distributed application architecture. You'll never provision a server again!

Besides writing and maintaining his passive income web projects, Obie is currently Chief Boot Officer at Kickass Consulting, where you can hire him for your own projects. His last jobby job was SVP of Engineering at NYC tech darling 2U. He has been CTO and co-founder of many startups including Mark Zuckerberg's beloved Andela and Trevor Owen's Lean Startup Machine. His published books include the acclaimed business title The Lean Enterprise. He also founded one of the world's best known Ruby on Rails web design and development agencies, Hashrocket and is author of the bible of Rails development, The Rails Way and series editor for Addison-Wesley's Professional Ruby Series.

On the rare occasion when Obie is not busy building products, consulting clients or writing books, you can find him behind the lens of his camera or DJing in the dust at Burning Man.

Follow @obie on Twitter or email him at 

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...

Write and Publish on Leanpub

Authors and publishers use Leanpub to publish amazing in-progress and completed ebooks, just like this one. You can use Leanpub to write, publish and sell your book as well! 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