update
(**kwargs)Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a given table.
Warning
This operation only applies to Version 2019.11.21 (Current) of global tables.
You can only perform one of the following operations at once:
UpdateTable
to perform other operations.UpdateTable
is an asynchronous operation; while it is executing, the table status changes fromACTIVE
toUPDATING
. While it isUPDATING
, you cannot issue anotherUpdateTable
request. When the table returns to theACTIVE
state, theUpdateTable
operation is complete.
See also: AWS API Documentation
Request Syntax
table = table.update(
AttributeDefinitions=[
{
'AttributeName': 'string',
'AttributeType': 'S'|'N'|'B'
},
],
BillingMode='PROVISIONED'|'PAY_PER_REQUEST',
ProvisionedThroughput={
'ReadCapacityUnits': 123,
'WriteCapacityUnits': 123
},
GlobalSecondaryIndexUpdates=[
{
'Update': {
'IndexName': 'string',
'ProvisionedThroughput': {
'ReadCapacityUnits': 123,
'WriteCapacityUnits': 123
}
},
'Create': {
'IndexName': 'string',
'KeySchema': [
{
'AttributeName': 'string',
'KeyType': 'HASH'|'RANGE'
},
],
'Projection': {
'ProjectionType': 'ALL'|'KEYS_ONLY'|'INCLUDE',
'NonKeyAttributes': [
'string',
]
},
'ProvisionedThroughput': {
'ReadCapacityUnits': 123,
'WriteCapacityUnits': 123
}
},
'Delete': {
'IndexName': 'string'
}
},
],
StreamSpecification={
'StreamEnabled': True|False,
'StreamViewType': 'NEW_IMAGE'|'OLD_IMAGE'|'NEW_AND_OLD_IMAGES'|'KEYS_ONLY'
},
SSESpecification={
'Enabled': True|False,
'SSEType': 'AES256'|'KMS',
'KMSMasterKeyId': 'string'
},
ReplicaUpdates=[
{
'Create': {
'RegionName': 'string',
'KMSMasterKeyId': 'string',
'ProvisionedThroughputOverride': {
'ReadCapacityUnits': 123
},
'GlobalSecondaryIndexes': [
{
'IndexName': 'string',
'ProvisionedThroughputOverride': {
'ReadCapacityUnits': 123
}
},
],
'TableClassOverride': 'STANDARD'|'STANDARD_INFREQUENT_ACCESS'
},
'Update': {
'RegionName': 'string',
'KMSMasterKeyId': 'string',
'ProvisionedThroughputOverride': {
'ReadCapacityUnits': 123
},
'GlobalSecondaryIndexes': [
{
'IndexName': 'string',
'ProvisionedThroughputOverride': {
'ReadCapacityUnits': 123
}
},
],
'TableClassOverride': 'STANDARD'|'STANDARD_INFREQUENT_ACCESS'
},
'Delete': {
'RegionName': 'string'
}
},
],
TableClass='STANDARD'|'STANDARD_INFREQUENT_ACCESS',
DeletionProtectionEnabled=True|False
)
An array of attributes that describe the key schema for the table and indexes. If you are adding a new global secondary index to the table, AttributeDefinitions
must include the key element(s) of the new index.
Represents an attribute for describing the key schema for the table and indexes.
A name for the attribute.
The data type for the attribute, where:
S
- the attribute is of type StringN
- the attribute is of type NumberB
- the attribute is of type BinaryControls how you are charged for read and write throughput and how you manage capacity. When switching from pay-per-request to provisioned capacity, initial provisioned capacity values must be set. The initial provisioned capacity values are estimated based on the consumed read and write capacity of your table and global secondary indexes over the past 30 minutes.
PROVISIONED
- We recommend using PROVISIONED
for predictable workloads. PROVISIONED
sets the billing mode to Provisioned Mode.PAY_PER_REQUEST
- We recommend using PAY_PER_REQUEST
for unpredictable workloads. PAY_PER_REQUEST
sets the billing mode to On-Demand Mode.The new provisioned throughput settings for the specified table or index.
The maximum number of strongly consistent reads consumed per second before DynamoDB returns a ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide .
If read/write capacity mode is PAY_PER_REQUEST
the value is set to 0.
The maximum number of writes consumed per second before DynamoDB returns a ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide .
If read/write capacity mode is PAY_PER_REQUEST
the value is set to 0.
An array of one or more global secondary indexes for the table. For each index in the array, you can request one action:
Create
- add a new global secondary index to the table.Update
- modify the provisioned throughput settings of an existing global secondary index.Delete
- remove a global secondary index from the table.You can create or delete only one global secondary index per UpdateTable
operation.
For more information, see Managing Global Secondary Indexes in the Amazon DynamoDB Developer Guide .
Represents one of the following:
The name of an existing global secondary index, along with new provisioned throughput settings to be applied to that index.
The name of the global secondary index to be updated.
Represents the provisioned throughput settings for the specified global secondary index.
For current minimum and maximum provisioned throughput values, see Service, Account, and Table Quotas in the Amazon DynamoDB Developer Guide .
The maximum number of strongly consistent reads consumed per second before DynamoDB returns a ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide .
If read/write capacity mode is PAY_PER_REQUEST
the value is set to 0.
The maximum number of writes consumed per second before DynamoDB returns a ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide .
If read/write capacity mode is PAY_PER_REQUEST
the value is set to 0.
The parameters required for creating a global secondary index on an existing table:
IndexName
KeySchema
AttributeDefinitions
Projection
ProvisionedThroughput
The name of the global secondary index to be created.
The key schema for the global secondary index.
Represents a single element of a key schema. A key schema specifies the attributes that make up the primary key of a table, or the key attributes of an index.
A KeySchemaElement
represents exactly one attribute of the primary key. For example, a simple primary key would be represented by one KeySchemaElement
(for the partition key). A composite primary key would require one KeySchemaElement
for the partition key, and another KeySchemaElement
for the sort key.
A KeySchemaElement
must be a scalar, top-level attribute (not a nested attribute). The data type must be one of String, Number, or Binary. The attribute cannot be nested within a List or a Map.
The name of a key attribute.
The role that this key attribute will assume:
HASH
- partition keyRANGE
- sort keyNote
The partition key of an item is also known as its hash attribute . The term "hash attribute" derives from DynamoDB's usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values.
The sort key of an item is also known as its range attribute . The term "range attribute" derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
Represents attributes that are copied (projected) from the table into an index. These are in addition to the primary key attributes and index key attributes, which are automatically projected.
The set of attributes that are projected into the index:
KEYS_ONLY
- Only the index and primary keys are projected into the index.INCLUDE
- In addition to the attributes described in KEYS_ONLY
, the secondary index will include other non-key attributes that you specify.ALL
- All of the table attributes are projected into the index.Represents the non-key attribute names which will be projected into the index.
For local secondary indexes, the total count of NonKeyAttributes
summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.
Represents the provisioned throughput settings for the specified global secondary index.
For current minimum and maximum provisioned throughput values, see Service, Account, and Table Quotas in the Amazon DynamoDB Developer Guide .
The maximum number of strongly consistent reads consumed per second before DynamoDB returns a ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide .
If read/write capacity mode is PAY_PER_REQUEST
the value is set to 0.
The maximum number of writes consumed per second before DynamoDB returns a ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide .
If read/write capacity mode is PAY_PER_REQUEST
the value is set to 0.
The name of an existing global secondary index to be removed.
The name of the global secondary index to be deleted.
Represents the DynamoDB Streams configuration for the table.
Note
You receive a ResourceInUseException
if you try to enable a stream on a table that already has a stream, or if you try to disable a stream on a table that doesn't have a stream.
Indicates whether DynamoDB Streams is enabled (true) or disabled (false) on the table.
When an item in the table is modified, StreamViewType
determines what information is written to the stream for this table. Valid values for StreamViewType
are:
KEYS_ONLY
- Only the key attributes of the modified item are written to the stream.NEW_IMAGE
- The entire item, as it appears after it was modified, is written to the stream.OLD_IMAGE
- The entire item, as it appeared before it was modified, is written to the stream.NEW_AND_OLD_IMAGES
- Both the new and the old item images of the item are written to the stream.The new server-side encryption settings for the specified table.
Indicates whether server-side encryption is done using an Amazon Web Services managed key or an Amazon Web Services owned key. If enabled (true), server-side encryption type is set to KMS
and an Amazon Web Services managed key is used (KMS charges apply). If disabled (false) or not specified, server-side encryption is set to Amazon Web Services owned key.
Server-side encryption type. The only supported value is:
KMS
- Server-side encryption that uses Key Management Service. The key is stored in your account and is managed by KMS (KMS charges apply).The KMS key that should be used for the KMS encryption. To specify a key, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter if the key is different from the default DynamoDB key alias/aws/dynamodb
.
A list of replica update actions (create, delete, or update) for the table.
Note
This property only applies to Version 2019.11.21 (Current) of global tables.
Represents one of the following:
CreateTableReplica
action in the destination Region.UpdateTable
action in the destination Region.DeleteTableReplica
action in the destination Region, deleting the replica and all if its items in the destination Region.Note
When you manually remove a table or global table replica, you do not automatically remove any associated scalable targets, scaling policies, or CloudWatch alarms.
The parameters required for creating a replica for the table.
The Region where the new replica will be created.
The KMS key that should be used for KMS encryption in the new replica. To specify a key, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter if the key is different from the default DynamoDB KMS key alias/aws/dynamodb
.
Replica-specific provisioned throughput. If not specified, uses the source table's provisioned throughput settings.
Replica-specific read capacity units. If not specified, uses the source table's read capacity settings.
Replica-specific global secondary index settings.
Represents the properties of a replica global secondary index.
The name of the global secondary index.
Replica table GSI-specific provisioned throughput. If not specified, uses the source table GSI's read capacity settings.
Replica-specific read capacity units. If not specified, uses the source table's read capacity settings.
Replica-specific table class. If not specified, uses the source table's table class.
The parameters required for updating a replica for the table.
The Region where the replica exists.
The KMS key of the replica that should be used for KMS encryption. To specify a key, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter if the key is different from the default DynamoDB KMS key alias/aws/dynamodb
.
Replica-specific provisioned throughput. If not specified, uses the source table's provisioned throughput settings.
Replica-specific read capacity units. If not specified, uses the source table's read capacity settings.
Replica-specific global secondary index settings.
Represents the properties of a replica global secondary index.
The name of the global secondary index.
Replica table GSI-specific provisioned throughput. If not specified, uses the source table GSI's read capacity settings.
Replica-specific read capacity units. If not specified, uses the source table's read capacity settings.
Replica-specific table class. If not specified, uses the source table's table class.
The parameters required for deleting a replica for the table.
The Region where the replica exists.
STANDARD
and STANDARD_INFREQUENT_ACCESS
.dynamodb.Table
Table resource