Menu
Amazon DynamoDB
Developer Guide (API Version 2012-08-10)

Requirements and Best Practices

Using DynamoDB global tables, you can replicate your table data across AWS Regions. It is important that each replica table and secondary index in your global table has identical write capacity settings to ensure proper replication of data.

Requirements for Adding a New Replica Table

If you want to add a new replica table to a global table, each of the following conditions must be true:

  • The table must have the same partition key as all of the other replicas.

  • The table must have the same write capacity management settings specified.

  • The table must have the same name as all of the other replicas.

  • The table must have DynamoDB Streams enabled, with the stream containing both the new and the old images of the item.

  • None of the replica tables in the global table can contain any data.

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 partition key and sort key (if present).

Important

Write capacity settings should be set consistently across all of your global tables’ replica tables and matching secondary indexes. To update write capacity settings for your global table, we strongly recommend using the DynamoDB console or the UpdateGlobalTableSettings call. UpdateGlobalTableSettings will apply changes to write capacity settings to all replica tables and matching secondary indexes in a global table automatically. If you use the UpdateTable, RegisterScalableTarget, or PutScalingPolicy calls, you should apply the change to each replica table and matching secondary index individually. For more information, see Amazon DynamoDB API Reference.

DynamoDB strongly recommends enabling auto scaling to manage provisioned write capacity settings. If you prefer to manage write capacity settings manually, you should provision equal replicated write capacity units to all of your replica tables. You should also provision equal replicated write capacity units to matching secondary indexes across your global table.

You must also have appropriate IAM permissions. For more information, see Using IAM with Global Tables.

Best Practices and Requirements for Managing Capacity

Use DynamoDB Auto Scaling (Recommended)

Using DynamoDB auto scaling is the recommended way to manage throughput capacity settings for replica tables. DynamoDB auto scaling automatically adjusts read capacity units (RCUs) and/or write capacity units (WCUs) for each replica table based upon your actual application workload. For more information, see Managing Throughput Capacity Automatically with DynamoDB Auto Scaling.

If you create your replica tables using the AWS Management Console, then auto scaling will be enabled by default for each replica table, with default auto scaling settings for managing RCUs and WCUs.

Changes to auto scaling settings for a replica table or secondary index made through the DynamoDB console or using the UpdateGlobalTableSettings call are applied to all of the replica tables and matching secondary indexes in the global table automatically and will overwrite any existing auto scaling settings. This ensures that provisioned write capacity settings are consistent across the replica tables and secondary indexes in your global table. If you use the UpdateTable, RegisterScalableTarget, or PutScalingPolicy calls, you should apply the change to each replica table and matching secondary index individually.

Manually Managing Capacity

If you decide not to use DynamoDB auto scaling, then you must manually set the read capacity and write capacity settings on each replica table and secondary index.

The provisioned replicated write capacity units (rWCUs) on every replica table should be set to the total number of rWCUs needed for application writes across all regions multiplied by two. This will accommodate application writes that occur in the local region and replicated application writes coming from other regions. For example, if you expect 5 writes per second to your replica table in Ohio and 5 writes per second to your replica table in N.Virginia, then you should provision 20 WCUs to each replica table (5 + 5 = 10; 10 x 2 = 20).

To update write capacity settings for your global table, we strongly recommend using the DynamoDB console or the UpdateGlobalTableSettings call. UpdateGlobalTableSettings will apply changes to write capacity settings to all replica tables and matching secondary indexes in a global table automatically. If you use the UpdateTable, RegisterScalableTarget, or PutScalingPolicy calls, you should apply the change to each replica table and matching secondary index individually. For more information, see Amazon DynamoDB API Reference.

Note

To update the settings (UpdateGlobalTableSettings) for a global table in DynamoDB, you must have the dynamodb:UpdateGlobalTable, dynamodb:DescribeLimits, application-autoscaling:DeleteScalingPolicy and application-autoscaling:DeregisterScalableTarget permissions. For more information, see Using IAM with Global Tables.