Serverless
Serverless
Patterns of Modern Application Design Using Microservices (Amazon Web Services Edition)
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)
Preface
Who Should Read This Book
Guide to Readers
Acknowledgments
Debt of Gratitude
Open-Source
Colophon
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)
Appendix
Getting Started with AWS
Setup an AWS Account
Create An Administrative IAM User
Store credentials locally
Attach AdministratorAccess policy
Glossary
Index
Bibliography
Table of Contents
-
-
Preface
- Who Should Read This Book
- Guide to Readers
- On Being Opinionated
- Acknowledgments
- Colophon
-
Preface
-
The Story
-
1. Introduction
- 1.1 BaaS
- 1.2 FaaS
- 1.3 Amazon Web Services
- 1.4 Benefits of a Serverless Microservices Approach
- 1.5 Historical Context
- 1.6 Cost Considerations
- 1.7 Prerequisites
- 1.8 Terminology
- 1.9 Static Structure
- 1.10 Motivation and Values
-
2. Microservices
- 2.1 Characteristics
- 2.2 Versus Layered Architecture
- 2.3 Microservices ala Fred George
- 2.4 Drawbacks
-
3. Practical Concerns
- 3.1 Team & Project Organization
- 3.2 Developer Sandbox Accounts
- 3.3 Testing
- 3.4 Deployment
- 3.5 Other Architecture Concerns
-
1. Introduction
-
The Patterns
-
4. Architectural Patterns
- 4.1 Asynchronous Messaging
- 4.2 Command and Query Responsibility Segregation (CQRS)
- 4.3 Event-Driven Architecture
- 4.4 Orchestrated Workflow
-
5. Microservice Roles
- 5.1 Message Originator
- 5.2 Content Enricher
- 5.3 Mediator
- 5.4 Coexisting Versions
- 5.5 Fanout
- 5.6 Async Waterfall (with optional Fanout)
- 5.7 Need Solution
- 5.8 Transformer
- 5.9 Worker
-
6. Integration Styles
- 6.1 File Transfer
- 6.2 Shared Database
- 6.3 Remote Procedure Invocation
- 6.4 Messaging
-
7. Messaging Systems
- 7.1 Message Channel
- 7.2 Message
- 7.3 Message Router
- 7.4 Message Translator
- 7.5 Pipes and Filters
-
8. Messaging Channels
- 8.1 Point-to-Point Channel
- 8.2 Publish-Subscribe Channel
- 8.3 Datatype Channel
- 8.4 Invalid Message Channel
-
9. Message Construction
- 9.1 Command Message
- 9.2 Document Message
- 9.3 Event Message
- 9.4 Request-Reply
- 9.5 Return Address
- 9.6 Correlation Identifier
- 9.7 Message Sequence
- 9.8 Message Expiration
- 9.9 Format Indicator
-
10. Message Routing
- 10.1 Content-Based Router
- 10.2 Message Filter
- 10.3 Dynamic Router
- 10.4 Recipient List
- 10.5 Splitter
- 10.6 Aggregator
- 10.7 Resequencer
- 10.8 Composed Message Processor
- 10.9 Scatter-Gather
- 10.10 Routing Slip
- 10.11 Process Manager
- 10.12 Queue Coupling
- 10.13 Message Broker
-
11. Message Transformation
- 11.1 Envelope Wrapper
- 11.2 Content Enricher
- 11.3 Content Filter
- 11.4 Claim Check
- 11.5 Normalizer
- 11.6 Canonical Data Model
-
12. Messaging Endpoints
- 12.1 Messaging Gateway
- 12.2 Competing Consumers
- 12.3 Message Dispatcher
- 12.4 Selective Consumer
- 12.5 Durable Subscriber
- 12.6 Using SQS
- 12.7 Using Kinesis
- 12.8 Idempotent Receiver
-
13. System Management
- 13.1 Control Bus
- 13.2 Message History
-
4. Architectural Patterns
-
The Services
- 14. API Gateway
- 15. Lambda
- 16. Identity and Access Management (IAM)
-
17. DynamoDB
- 17.1 Concepts
-
18. Cognito
- 18.1 Initial Setup
- 18.2 Using Cognito in Client Code
-
19. Simple Notification Service (SNS)
- 19.1 Example Uses
- 19.2 Benefits
- 19.3 Basics
-
20. Simple Queue Service (SQS)
- 20.1 Architectural Overview
- 20.2 SQS Features
- 20.3 Properties of Distributed Queues
- 20.4 How is Amazon SNS different from Amazon SQS?
-
21. S3 (Simple Storage Service)
- 21.1 Buckets
- 21.2 Static Website Hosting
- 21.3 Events
- 21.4 Storage Classes
-
22. ElastiCache
- 22.1 Memcached
- 22.2 Redis
- 22.3 Features
- 23. Redshift
- 24. Simple Workflow (SWF)
- 25. CloudFront
- 26. CloudWatch
- 27. Elastic Beanstalk (EB)
- 28. Virtual Private Cloud (VPC)
-
The Case Study
-
29. FoodButton
- 29.1 Functionality
- 29.2 A Living System
- 29.3 Sample Code
- 29.4 Systems
- 29.5 High-Level Requirements
- 29.6 Collaboration of Microservices
- 29.7 Implementation Using AWS
- 29.8 Conclusion
-
30. Waiter
- 30.1 API Gateway Setup
- 30.2 Lambda Handler Function
- 31. StripeCashier
- 32. FeedbackHistorian
- 33. RestaurantPicker
- 34. RestaurantNotifier
-
35. DataWarehouseClerk
- 35.1 Implementation
- 36. DeliveryMap
-
29. FoodButton
-
Appendix
-
Getting Started with AWS
- Setup an AWS Account
- Create An Administrative IAM User
- Store credentials locally
- Attach AdministratorAccess policy
-
AWS Fundamentals
- AWS Command-Line Interface
- SDK Libraries
- Configuration Information
- Credentials
- Signed Requests
- Retry Logic
- Regions
- Service Limits
-
Serverless Framework
- Summary
- SLS Services
- Example
- Installing SLS
- Creating a Project
- Deployment
-
Saws
- Installation
- Usage
- DynamoDB
- SNS (Simple Notification Service)
- Glossary
- Index
- Bibliography
-
Getting Started with AWS
- Notes
Other books by this author
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...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book 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