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
Authors have earned$9,908,691writing, 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. 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) and MOBI (for 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
C++ Best Practices
Jason TurnerLevel up your C++, get the tools working for you, eliminate common problems, and move on to more exciting things!
Continuous Delivery Pipelines
Dave FarleyThis practical handbook provides a step-by-step guide for you to get the best continuous delivery pipeline for your software.
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.
C++20
Rainer GrimmC++20 is the next big C++ standard after C++11. As C++11 did it, C++20 changes the way we program modern C++. This change is, in particular, due to the big four of C++20: ranges, coroutines, concepts, and modules.
The book is almost daily updated. These incremental updates ease my interaction with the proofreaders.
Atomic Kotlin
Bruce Eckel and Svetlana IsakovaFor both beginning and experienced programmers! From the author of the multi-award-winning Thinking in C++ and Thinking in Java together with a member of the Kotlin language team comes a book that breaks the concepts into small, easy-to-digest "atoms," along with exercises supported by hints and solutions directly inside IntelliJ IDEA!
Introductory Statistics with Randomization and Simulation
Mine Cetinkaya-Rundel, Christopher Barr, OpenIntro, and David DiezA complete foundation for Statistics, also serving as a foundation for Data Science, that introduces inference using randomization and simulation while covering traditional methods.
Leanpub revenue supports OpenIntro, so we can provide free desk copies to teachers interested in using our books in the classroom.
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.
Java OOP Done Right
Alan MellorObject Oriented Programming is still a great way to create clean, maintainable code. But only if you use it right.
This book gives you 25 years of OO best practice, ready to use.
You'll learn to design objects behaviour-first, use TDD to help, then confidently apply Design Patterns, SOLID principles and Refactoring to make clean, crafted code.
Introducing EventStorming
Alberto BrandoliniThe deepest tutorial and explanation about EventStorming, straight from the inventor.
Discrete Mathematics for Computer Science
Alexander Shen, Alexander S. Kulikov, Vladimir Podolskii, and Aleksandr GolovnevThis book supplements the DM for CS Specialization at Coursera and contains many interactive puzzles, autograded quizzes, and code snippets. They are intended to help you to discover important ideas in discrete mathematics on your own. By purchasing the book, you will get all updates of the book free of charge when they are released.
Top Bundles
- #1
Software Architecture for Developers: Volumes 1 & 2 - Technical leadership and communication
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... - #2
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... - #3
Cisco CCNA 200-301 Complet
4 Books
Ce lot comprend les quatre volumes du guide préparation à l'examen de certification Cisco CCNA 200-301. - #4
Modern C++ by Nicolai Josuttis
2 Books
- #5
CCDE Practical Studies (All labs)
3 Books
CCDE lab - #6
"The C++ Standard Library" and "Concurrency with Modern C++"
2 Books
Get my books "The C++ Standard Library" and "Concurrency with Modern C++" in a bundle. The first book gives you the details you should know about the C++ standard library; the second one dives deeper into concurrency with modern C++. In sum, you get more than 600 pages full of modern C++ and about 250 source files presenting the standard library... - #7
Mastering Containers
2 Books
Docker and Kubernetes are taking the world by storm! These books will get you up-to-speed fast! Docker Deep Dive is over 400 pages long, and covers all objectives on the Docker Certified Associate exam.The Kubernetes Book includes everything you need to get up and running with Kubernetes! - #8
Modern Management Made Easy
3 Books
Read all three Modern Management Made Easy books. Learn to manage yourself, lead and serve others, and lead the organization. - #9
The Future of Digital Health
6 Books
We put together the most popular books from The Medical Futurist to provide a clear picture about the major trends shaping the future of medicine and healthcare. Digital health technologies, artificial intelligence, the future of 20 medical specialties, big pharma, data privacy and how technology giants such as Amazon or Google want to conquer... - #10
Django for Beginners/APIs/Professionals
3 Books