Scale across borders: build a multi-region architecture while maintaining data residency
In this post, we cover a high-level reference architecture to illustrate how you can deploy a multi-region architecture while maintaining data residency. This architecture is suitable for scaling startups and businesses operating in regulated industries and, those who are building the foundation for a global business.
AWS reference architecture for multi-region with data residency
Preparing for a multi-region architecture
Be wary of added cost and complexity
Deep dive into regulatory and compliance requirements
Consider a simpler architecture
Considerations and best-practices when adopting a multi-region architecture
Support local requirements through global customization
Build foundation for efficiency using SaaS design principles
Bind user identity to tenant identity
- User connects to application hosted on AWS Amplify. Amazon CloudFront provides global edge caching to minimize end-user latency.
- Amazon Cognito is used for authentication including login and sign up. It is a regional service and can be deployed to each region. The application can integrate to Cognito using Amplify UI Authenticator.
- Amazon DynamoDB Global Tables is used to store the user’s data residency and replicated across regions. Amazon Cognito Lambda Triggers (pre-auth and pre-signup) will use the data to ensure that the user is allocated to the appropriate region.
- Amazon Route 53 Geolocation Routing (alternatively Latency Routing) provides a global API endpoint based on the user’s geolocation, and failover capability.
- Amazon API Gateway Regional Endpoint (alternatively Application Load Balancer) provides an endpoint for each region. See #8 for more details.
- AWS Lambda (or alternative compute services such as Amazon ECS with Fargate) provides the backend for the API.
- Storage and databases (such as Amazon Simple Storage Service (S3) and Amazon Relational Database Service (RDS), and Amazon DynamoDB) is used to store sensitive data. These are isolated to each region.
- Optionally, the regional API endpoint can be accessed directly for the user to access their desired region, bypassing the default. For additional security, consider Amazon CloudFront and AWS WAF.
custom:region
user attribute which is then passed to the application via JSON Web Tokens (JWT) tokens as a custom claim. As the application is expanded to multiple services, each service can simply use the token to gain tenant awareness. Without relying on another service, each service can decrypt the tokens to determine the context, apply the appropriate isolation logic, connect to the relevant data source as well as pass data to monitoring and logging tools. The logic can be abstracted from developers for development efficiency and simplicity.Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.