Architecture for multi-region ECS application

0

Hi everyone, I just wanted to get feedback on my proposed solution for a multi-region ECS dockerized app. Currently we have the following resources in Region A:

Postgres DB (Used for user accounts only)
Backend+Frontend NextJS App (Dockerized) ECS
Backend Microservice App for conversion of files (Dockerized) ECS
Backend 3rd party API + Datastore (This resource is also deployed in other regions) Unknown architecture

I now need to deploy to Regions B and C. The Backend 3rd party API is already deployed in these regions. I am thinking of deploying the following resources to the following regions:

Backend+Frontend NextJS App (Dockerized)
Backend Microservice App for conversion of files (Dockerized)

Our app logs in the user (authentication + authorization) using the 3rd party API, and after login we can see which region their data is in. So after login I can bounce them + their token to the appropriate region. I cannot use Route53 routing reliably because the Source of Truth about their region is available after login, and, for example, they may be (rarely) accessing from region B (if they are travelling) while their datastore is in region C (In which case I need to bounce them to region C). I also don't need to replicate our database to other regions because it only stores their account information for billing purposes, so the performance impact is minimal and only checked on login/logout.

Currently we have low 10s of users, so I can easily restructure and deploy a different architecture if/when we start scaling. Critique is welcome!

2 Answers
0

Hi,

Based on the use case that you have described; I see that you have a third-party API that does the login and routing to the different regions’ applications. Since we are unaware on the working of how this third-party API is architected to route the requests to the Apps in different regions and your use case involves bouncing between regions after the login, I am unable to provide any suggestions on that front. Here are some articles that illustrates the creation of Multi Region Container Application that include some interesting details and approaches when configuring a Multi Region Application in AWS.

https://aws.amazon.com/blogs/architecture/creating-a-multi-region-application-with-aws-services-part-1-compute-and-security/

https://aws.amazon.com/blogs/architecture/creating-a-multi-region-application-with-aws-services-part-2-data-and-replication/

https://aws.amazon.com/blogs/architecture/creating-a-multi-region-application-with-aws-services-part-3-application-management-and-monitoring/

AWS
SUPPORT ENGINEER
answered 3 years ago
profile picture
EXPERT
reviewed 10 months ago
0

Your proposed solution looks solid, especially given your current scale. Here are a few thoughts:

  1. Multi-Region Architecture: It makes sense to deploy the Next.js app and the conversion microservice to multiple regions. This will help minimize latency for users accessing from different regions.

  2. User Authentication: Your approach to handle user authentication and redirection based on the region is practical. Just ensure that the token handling is secure and efficient to avoid unnecessary delays during the redirection process.

  3. Database Considerations: Since the Postgres DB is only storing account info, you’re right to avoid replication. Just keep an eye on the performance as user numbers grow, especially if login/logout spikes occur. You might want to consider using a caching layer for the auth info to reduce DB load.

  4. Logging and Monitoring: With a multi-region setup, ensure you have centralized logging and monitoring. This will help you track issues across regions and provide insights into user behavior.

  5. Future Scalability: It's great that you’re keeping scalability in mind. As your user base grows, consider strategies for database scaling, like read replicas or migrating to a managed service that supports multi-region replication.

Overall, it seems like a thoughtful design for your current needs. Just be prepared to adapt as you grow!

profile picture
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions