AWS Prescriptive Guidance Enabling data persistence in microservices
Table of Contents
Introduction ..................................................................................................................................... 1
Targeted business outcomes ...................................................................................................................... 3
Patterns for enabling data persistence .......................................................................................... 4
Database-per-service pattern ..................................................................................................................... 4
API composition pattern ............................................................................................................................. 6
CQRS pattern ................................................................................................................................................. 8
Event sourcing pattern ............................................................................................................................. 11
Amazon Kinesis Data Streams implementation ............................................................................. 12
Amazon EventBridge implementation .............................................................................................. 13
Saga pattern ................................................................................................................................................ 14
Shared-database-per-service pattern .................................................................................................... 16
FAQ ................................................................................................................................................. 18
When can I modernize my monolithic database as part of my modernization journey? ............. 18
Can I keep a legacy monolithic database for multiple microservices? ............................................ 18
What should I consider when designing databases for a microservices architecture? ................. 18
What is a common pattern for maintaining data consistency across different
microservices? ............................................................................................................................................. 18
How do I maintain transaction automation? ....................................................................................... 19
Do I have to use a separate database for each microservice? .......................................................... 19
How can I keep a microservice’s persistent data private if they all share a single database? ...... 19
Resources ........................................................................................................................................ 20
Related guides and patterns .................................................................................................................. 20
Other resources ......................................................................................................................................... 20
Document history .......................................................................................................................... 21
Glossary .......................................................................................................................................... 22
# ..................................................................................................................................................................... 22
A ..................................................................................................................................................................... 23
B ..................................................................................................................................................................... 26
C ..................................................................................................................................................................... 28
D ..................................................................................................................................................................... 31
E ..................................................................................................................................................................... 35
F ..................................................................................................................................................................... 37
G ..................................................................................................................................................................... 38
H ..................................................................................................................................................................... 39
iii