Modernising with Purpose-Built Data Stores and Legacy Integration
This lesson explains how modernised services each use the data store that fits their access pattern, and how they integrate with legacy systems that cannot change yet.
Learning outcomes
After completing this lesson, you will be able to:
- Choose data stores by access pattern.
- Integrate with legacy messaging through Amazon MQ.
- Explain how data moves to a new store modelled from access patterns.
Data stores by access pattern
Modernising often means moving parts of one relational database into stores built for each access pattern, described in more detail in Selecting Purpose-Built Databases. Caching and session data move to ElastiCache, and high-scale key-value access to DynamoDB. Relationship queries move to Neptune, time series to Timestream, full-text search to OpenSearch Service, and MongoDB-compatible documents to DocumentDB. The following table summarises the mapping.
| Need | Service |
|---|---|
| Caching and sessions | ElastiCache |
| Key-value at scale | DynamoDB |
| Graphs | Neptune |
| Time series | Timestream |
| Search | OpenSearch Service |
| Documents (MongoDB-compatible) | DocumentDB |
Integrating with legacy systems
Modernisation rarely replaces everything at once, so new services must work alongside legacy systems. Applications that use standard messaging protocols, JMS, AMQP, MQTT or STOMP, can move to Amazon MQ, which runs ActiveMQ or RabbitMQ without code changes. Applications using Kafka move to Amazon MSK. EventBridge Pipes connects a source to a target point to point, with filtering and enrichment along the way. To feed new data stores from a legacy database while it is still in use, DMS change data capture or zero-ETL integrations replicate its changes continuously. The following table summarises the options.
| Need | Service |
|---|---|
| Legacy JMS, AMQP, MQTT, STOMP | Amazon MQ (ActiveMQ, RabbitMQ) |
| Kafka | Amazon MSK |
| Point-to-point with filtering and enrichment | EventBridge Pipes |
| Changes from a legacy database feeding new stores | DMS change data capture, or zero-ETL integrations |
Feeding new stores from legacy systems
Moving data to a new store
A new data store is modelled from the service's access patterns; copying a relational schema table by table into DynamoDB rarely works, because DynamoDB is designed around queries rather than normalised entities. AWS DMS migrates the existing data and then keeps the old and new stores in sync during the transition, so the legacy system can continue to run while the new service takes over.
Once services own separate stores, changes propagate between them through DynamoDB Streams or EventBridge events. The services are then eventually consistent with each other, and user journeys are designed around that, for example by showing that an action is being processed rather than assuming that every store is already up to date.
Modernising around a legacy JMS application
An insurer's policy system publishes events to an on-premises ActiveMQ broker using JMS, and a dozen consumers depend on them. The insurer wants to build new services on AWS without rewriting the policy system yet. The broker moves to Amazon MQ for ActiveMQ in an active/standby deployment across two Availability Zones; the policy system needs only a new broker URL. New services do not consume JMS directly: an EventBridge Pipe reads from the Amazon MQ queue, enriches each message with a Lambda function that decodes it into a standard JSON event, and delivers it to an event bus, where rules route each event type to its consumers:
aws pipes create-pipe --name policy-events \
--source arn:aws:mq:eu-west-1:111111111111:broker:policy-broker:b-1234 \
--source-parameters '{"ActiveMQBrokerParameters":{"QueueName":"policy.events",
"Credentials":{"BasicAuth":"arn:aws:secretsmanager:eu-west-1:111111111111:secret:mq-pipe"}}}' \
--enrichment arn:aws:lambda:eu-west-1:111111111111:function:normalise-policy-event \
--target arn:aws:events:eu-west-1:111111111111:event-bus/policy \
--role-arn arn:aws:iam::111111111111:role/pipes-policyFrom the bus, each new service stores what it needs in a purpose-built store: a quotes service keeps policy summaries in DynamoDB keyed by customer, and a search service indexes policies in OpenSearch Service. The legacy system remains the source of truth until it is replaced, and no new service reads its database.
How can a new service receive changes from a legacy relational database without changing the legacy application?
Show answer
With change data capture, for example AWS DMS streaming ongoing changes to Kinesis or another target.
Exam Tips
Remember for the exam
- To integrate a legacy JMS or AMQP application without code changes, use Amazon MQ.
- Choose each service's data store from its access patterns.
- To connect a source to a target with filtering and enrichment but no code, use EventBridge Pipes.
- Use DMS CDC to keep a new data store in sync with a legacy database during the transition.
- Design new data models for the target store rather than copying the relational schema.