Reputation: 151
In DynamoDB, if one region is not available or down (When we have global table and multiple replica) how to redirect request to a different Region and perform reads and writes against a different replica table ?
Does DynamoDB handles that internally or do we need to handle it? If we need to handle it through a program then how should we do that?
Upvotes: 3
Views: 2480
Reputation: 915
We can handle the redirect to a different region in the following ways (DynamoDB does NOT handle this automatically):
Please refer this AWS blog https://aws.amazon.com/blogs/database/part-3-build-resilient-applications-with-amazon-dynamodb-global-tables/
Upvotes: 0
Reputation: 368
If a single AWS Region becomes isolated or degraded, your application can redirect to a different Region and perform reads and writes against a different replica table. You can apply custom business logic to determine when to redirect requests to other Regions.
If a Region becomes isolated or degraded, DynamoDB keeps track of any writes that have been performed but have not yet been propagated to all of the replica tables. When the Region comes back online, DynamoDB resumes propagating any pending writes from that Region to the replica tables in other Regions. It also resumes propagating writes from other replica tables to the Region that is now back online.
Refer - AWS DynamoDB Documentation
To answer - The replication is taken care of by AWS, however you will have to take care of the region where your app will be connecting in the event of downtime.
Upvotes: 3
Reputation: 1178
Your DynamoDB tables can be replicated in other AWS regions (aka "Global Tables") following the process described in the documentation here: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/V2globaltables.tutorial.html.
I believe that the replication itself is completely handled internally. However, you should be able to choose to which replica you want to connect in your application. One way to do it would be to set the region as explained here for the JavaScript SDK: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-region.html.
That way, you can add logic in your application where if connecting to a table in one region does not work, you can try to connect to the table in a different region. How does that sound?
Upvotes: 0