redzedi
redzedi

Reputation: 1995

Are GSI on Global table of dynamodb replicated automatically?

I have a gsi defined ( in usw2 region) of a global table that is configured to replicate automatically to use2 . I have a gsi defined in usw2 for my table - will the index be replicated automatically ? or do i need go create that manually in the other region too ?

Upvotes: 3

Views: 984

Answers (1)

Nadav Har'El
Nadav Har'El

Reputation: 13731

There are two ways to add a region to a global table. In the old way - which was the usual way until November 2019 - you would need to create the same table yourself, and indeed you would also need to create the same indexes yourself in the other region too. You would then use UpdateGlobalTable. Quoting this operation's documentation:

If global secondary indexes are specified, then the following conditions must also be met:

  • The global secondary indexes must have the same name.
  • The global secondary indexes must have the same hash key and sort key (if present).
  • The global secondary indexes must have the same provisioned and maximum write capacity units.

The new (November 2019) way to replicate to another region is to use UpdateTable with the ReplicaUpdates parameter. This way does not require you to create the table table manually in the other reason. Amazon did not seem to document how that table is created, and whether the same indexes are also created on it, but given the above information, I don't see any reason why it wouldn't create the same indexes, just like was always the requirement.

Of course, the best thing for you to do is to just try it, and report back your findings :-)

Upvotes: 3

Related Questions