interface GlobalSecondaryIndexProps
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.DynamoDB.GlobalSecondaryIndexProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsdynamodb#GlobalSecondaryIndexProps |
Java | software.amazon.awscdk.services.dynamodb.GlobalSecondaryIndexProps |
Python | aws_cdk.aws_dynamodb.GlobalSecondaryIndexProps |
TypeScript (source) | aws-cdk-lib » aws_dynamodb » GlobalSecondaryIndexProps |
Properties for a global secondary index.
Example
const table = new dynamodb.Table(this, 'Table', {
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
contributorInsightsSpecification: { // for a table
enabled: true,
mode: dynamodb.ContributorInsightsMode.THROTTLED_KEYS, // only emit throttling events
},
});
table.addGlobalSecondaryIndex({
contributorInsightsSpecification: { // for a specific global secondary index
enabled: true,
},
indexName: 'gsi',
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
});
Properties
| Name | Type | Description |
|---|---|---|
| index | string | The name of the secondary index. |
| contributor | boolean | Whether CloudWatch contributor insights is enabled for the specified global secondary index. |
| contributor | Contributor | Whether CloudWatch contributor insights is enabled and what mode is selected. |
| max | number | The maximum read request units for the global secondary index. |
| max | number | The maximum write request units for the global secondary index. |
| non | string[] | The non-key attributes that are projected into the secondary index. |
| partition | Attribute | Partition key attribute definition. |
| partition | Attribute[] | Compound partition key. |
| projection | Projection | The set of attributes that are projected into the secondary index. |
| read | number | The read capacity for the global secondary index. |
| sort | Attribute | Sort key attribute definition. |
| sort | Attribute[] | Compound sort key. |
| warm | Warm | The warm throughput configuration for the global secondary index. |
| write | number | The write capacity for the global secondary index. |
indexName
Type:
string
The name of the secondary index.
contributorInsightsEnabled?
⚠️ Deprecated: use contributorInsightsSpecification instead
Type:
boolean
(optional, default: false)
Whether CloudWatch contributor insights is enabled for the specified global secondary index.
contributorInsightsSpecification?
Type:
Contributor
(optional, default: contributor insights is not enabled)
Whether CloudWatch contributor insights is enabled and what mode is selected.
maxReadRequestUnits?
Type:
number
(optional, default: on-demand throughput is disabled)
The maximum read request units for the global secondary index.
Can only be provided if table billingMode is PAY_PER_REQUEST.
maxWriteRequestUnits?
Type:
number
(optional, default: on-demand throughput is disabled)
The maximum write request units for the global secondary index.
Can only be provided if table billingMode is PAY_PER_REQUEST.
nonKeyAttributes?
Type:
string[]
(optional, default: No additional attributes)
The non-key attributes that are projected into the secondary index.
partitionKey?
Type:
Attribute
(optional, default: exactly one of partitionKey and partitionKeys must be specified.)
Partition key attribute definition.
If a single field forms the partition key, you can use this field. Use the
partitionKeys field if the partition key is a compound key (consists of
multiple fields).
partitionKeys?
Type:
Attribute[]
(optional, default: exactly one of partitionKey and partitionKeys must be specified.)
Compound partition key.
If a single field forms the partition key, you can use either
partitionKey or partitionKeys to specify the partition key. Exactly
one of these must be specified.
You must use partitionKeys field if the partition key is a compound key
(consists of multiple fields).
NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields.
The order of fields is not important.
projectionType?
Type:
Projection
(optional, default: ALL)
The set of attributes that are projected into the secondary index.
readCapacity?
Type:
number
(optional, default: 5)
The read capacity for the global secondary index.
Can only be provided if table billingMode is Provisioned or undefined.
sortKey?
Type:
Attribute
(optional, default: no sort key)
Sort key attribute definition.
If a single field forms the sort key, you can use this field. Use the
sortKeys field if the sort key is a compound key (consists of multiple
fields).
sortKeys?
Type:
Attribute[]
(optional, default: no sort key)
Compound sort key.
If a single field forms the sort key, you can use either
sortKey or sortKeys to specify the sort key. At most one of these
may be specified.
You must use sortKeys field if the sort key is a compound key
(consists of multiple fields).
NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields at the same time.
NOTE: The order of fields is important!
warmThroughput?
Type:
Warm
(optional, default: no warm throughput is configured)
The warm throughput configuration for the global secondary index.
writeCapacity?
Type:
number
(optional, default: 5)
The write capacity for the global secondary index.
Can only be provided if table billingMode is Provisioned or undefined.

.NET
Go
Java
Python
TypeScript (