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
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.
See full terms
Do Well. Do Good.
Authors have earned$11,845,077writing, 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
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
Top Books
The Hitchhiker's Guide to DFIR: Experiences From Beginners and Experts
Barry Grundy, Tristram, John Haynes, ApexPredator, Andrew Rathbun, Kevin Pagano, Victor Heiland, Nisarg Suthar, Guus Beckers, and Jason WilkinsA first-of-its-kind crowdsourced Digital Forensics and Incident Response (DFIR) book by the Digital Forensics Discord Server members to share knowledge!
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Maîtriser Apache JMeter
Philippe Mouawad, Bruno Demion (Milamber), and Antonio Gomes RodriguesToute la puissance d'Apache JMeter expliquée par ses commiteurs et utilisateurs experts. De l'intégration continue en passant par le Cloud, vous découvrirez comment intégrer JMeter à vos processus "Agile" et Devops.
If you're looking for the newer english version of this book, go to Master JMeter : From load testing to DevOps
Software Architecture for Developers
Simon BrownA developer-friendly, practical and pragmatic guide to lightweight software architecture, technical leadership and the balance with agility.
Functional Event-Driven Architecture
Gabriel VolpeExplore the event-driven architecture (EDA) in a purely functional way. Learn to design and develop distributed systems that scale. Identify common design patterns in such systems.
Take your functional programming skills to the next level by joining me in developing a distributed system powered by Apache Pulsar and Fs2 streams, all in Scala 3!
R Programming for Data Science
Roger D. PengThis book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
Concurrency with Modern C++
Rainer GrimmC++11 is the first C++ standard that deals with concurrency. The story goes on with C++17, C++20, and will continue with C++23.
I'll give you a detailed insight into the current and the upcoming concurrency in C++. This insight includes the theory and a lot of practice.
Thinking with Types
Sandy MaguireThis book aims to be the comprehensive manual for type-level programming. It's about getting you from here to there---from a competent Haskell programmer to one who convinces the compiler to do their work for them.
Biological Modeling
Phillip CompeauIn this ebook, learn why zebras have stripes, why SARS-CoV-2 spread so quickly around the planet, how to train a computer to classify cellular images, and more!
Top Bundles
- #1
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #2
Modern C++ Collection
3 Books
Get All about Modern C++C++ Standard Library, including C++20Concurrency with Modern C++, including C++20C++20Each book has about 200 complete code examples. Updates are included. When I update one of the books, you immediately get the updated bundle. You can expect significant updates to each new C++ standard (C++23, C++26, .. ) and also... - #3
Software Architecture
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #4
Practical FP in Scala + Functional event-driven architecture
2 Books
Practical FP in Scala (A hands-on approach) & Functional event-driven architecture, aka FEDA, (Powered by Scala 3), together as a bundle! The content of PFP in Scala is a requirement to understand FEDA so why not take advantage of this bundle!? - #6
Pattern-Oriented Memory Forensics and Malware Detection
2 Books
This training bundle for security engineers and researchers, malware and memory forensics analysts includes two accelerated training courses for Windows memory dump analysis using WinDbg. It is also useful for technical support and escalation engineers who analyze memory dumps from complex software environments and need to check for possible... - #8
Learn Git, Bash, and Terraform the Hard Way
3 Books
Learn Git, Bash and Terraform using the Hard Way method.These technologies are essential tools in the DevOps armoury. These books walk you through their features and subtleties in a simple, gradual way that reinforces learning rather than baffling you with theory. - #9
Quality Software
11 Books
The Quality Software Bundle is for managers, would-be managers, and any of us who find themselves being managed and confused. This comprehensive bundle covers the entire span of software development approaches, from hacking through waterfall, cascade, prototyping, Iterative enhancement, reusable code, off-the-shelf, to Agile teams. The bundle... - #10
Static Analysis and Automated Refactoring
2 Books
As PHP developers we are living in the "Age of Static Analysis". We can use a tool like PHPStan to learn about potential bugs before we ship our code to production, and we can enforce our team's programming standards using custom PHPStan rules. Recipes for Decoupling by Matthias Noback teaches you in great detail how to do this, while also...