Adds or removes replicas in the specified global table. The global table must already exist to be able to use this operation. Any replica to be added must be empty, have the same name as the global table, have the same key schema, have DynamoDB Streams enabled, and have the same provisioned and maximum write capacity units.
This documentation is for version 2017.11.29 (Legacy) of global tables, which should be avoided for new global tables. Customers should use Global Tables version 2019.11.21 (Current) when possible, because it provides greater flexibility, higher efficiency, and consumes less write capacity than 2017.11.29 (Legacy).
To determine which version you're using, see Determining the global table version you are using. To update existing global tables from version 2017.11.29 (Legacy) to version 2019.11.21 (Current), see Upgrading global tables.
If you are using global tables Version 2019.11.21 (Current) you can use UpdateTable instead.
Although you can use UpdateGlobalTable to add replicas and remove replicas in a single request, for simplicity we recommend that you issue separate requests for adding or removing replicas.
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.
Parameters:
-
global_table_name
(TableName)
–
-
replica_updates
(ReplicaUpdateList)
–
A list of Regions that should be added or removed from the global table.
Raises:
Source code in docs_src/capo_dynamodb/_services/async_dynamo_db.py
| async def update_global_table(
self,
global_table_name: "capo_dynamodb.types.table_name.TableName",
replica_updates: "capo_dynamodb.types.replica_update_list.ReplicaUpdateList",
*,
config_overrides: Optional[AsyncDynamoDBClientConfig] = None,
) -> "capo_dynamodb.types.update_global_table_output.UpdateGlobalTableOutput":
"""<p>Adds or removes replicas in the specified global table. The global table must already exist to be able to use this operation. Any replica to be added must be empty, have the same name as the global table, have the same key schema, have DynamoDB Streams enabled, and have the same provisioned and maximum write capacity units.</p> <important> <p>This documentation is for version 2017.11.29 (Legacy) of global tables, which should be avoided for new global tables. Customers should use <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GlobalTables.html">Global Tables version 2019.11.21 (Current)</a> when possible, because it provides greater flexibility, higher efficiency, and consumes less write capacity than 2017.11.29 (Legacy).</p> <p>To determine which version you're using, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.DetermineVersion.html">Determining the global table version you are using</a>. To update existing global tables from version 2017.11.29 (Legacy) to version 2019.11.21 (Current), see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/V2globaltables_upgrade.html">Upgrading global tables</a>.</p> </important> <note> <p> If you are using global tables <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GlobalTables.html">Version 2019.11.21</a> (Current) you can use <a href="https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html">UpdateTable</a> instead. </p> <p> Although you can use <code>UpdateGlobalTable</code> to add replicas and remove replicas in a single request, for simplicity we recommend that you issue separate requests for adding or removing replicas. </p> </note> <p> If global secondary indexes are specified, then the following conditions must also be met: </p> <ul> <li> <p> The global secondary indexes must have the same name. </p> </li> <li> <p> The global secondary indexes must have the same hash key and sort key (if present). </p> </li> <li> <p> The global secondary indexes must have the same provisioned and maximum write capacity units. </p> </li> </ul>
Args:
global_table_name: <p>The global table name.</p>
replica_updates: <p>A list of Regions that should be added or removed from the global table.</p>
Raises:
capo_dynamodb.errors.global_table_not_found_exception.GlobalTableNotFoundException: <p>The specified global table does not exist.</p>
capo_dynamodb.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
capo_dynamodb.errors.invalid_endpoint_exception.InvalidEndpointException
capo_dynamodb.errors.replica_already_exists_exception.ReplicaAlreadyExistsException: <p>The specified replica is already part of the global table.</p>
capo_dynamodb.errors.replica_not_found_exception.ReplicaNotFoundException: <p>The specified replica is no longer part of the global table.</p>
capo_dynamodb.errors.table_not_found_exception.TableNotFoundException: <p>A source table with the name <code>TableName</code> does not currently exist within the subscriber's account or the subscriber is operating in the wrong Amazon Web Services Region.</p>
capo_dynamodb.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_dynamodb.types.update_global_table_input.UpdateGlobalTableInput]",
) -> AsyncOperationResponse[
"capo_dynamodb.types.update_global_table_output.UpdateGlobalTableOutput"
]:
import capo_dynamodb._operations.dynamo_db_20120810.update_global_table
(
output,
http_response,
) = await capo_dynamodb._operations.dynamo_db_20120810.update_global_table.async_update_global_table(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("UpdateGlobalTable")
)
input_: capo_dynamodb.types.update_global_table_input.UpdateGlobalTableInput = {
"global_table_name": global_table_name,
"replica_updates": replica_updates,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|