Skip to content
v2.275.0

GlobalSecondaryIndexProps Struct ​

Properties for a global secondary index.

Example ​

ts
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 ​

contributorInsightsEnabledoptionalbooleancontributor_insights_enabledoptionalboolcontributorInsightsEnabledoptionalBooleanContributorInsightsEnabledoptionalboolContributorInsightsEnabledoptional*bool= falsedeprecated#
use `contributorInsightsSpecification` instead
contributorInsightsSpecificationoptionalContributorInsightsSpecificationcontributor_insights_specificationoptionalContributorInsightsSpecificationcontributorInsightsSpecificationoptionalContributorInsightsSpecificationContributorInsightsSpecificationoptionalContributorInsightsSpecificationContributorInsightsSpecificationoptionalContributorInsightsSpecification#
Whether CloudWatch contributor insights is enabled and what mode is selected.

Default: contributor insights is not enabled

indexNamestringindex_namestrindexNameStringIndexNamestringIndexName*stringrequired#
The name of the secondary index.
maxReadRequestUnitsoptionalnumbermax_read_request_unitsoptionalint | floatmaxReadRequestUnitsoptionalNumberMaxReadRequestUnitsoptionaldoubleMaxReadRequestUnitsoptional*float64#
The maximum read request units for the global secondary index.

Default: on-demand throughput is disabled

Can only be provided if table billingMode is PAY_PER_REQUEST.

maxWriteRequestUnitsoptionalnumbermax_write_request_unitsoptionalint | floatmaxWriteRequestUnitsoptionalNumberMaxWriteRequestUnitsoptionaldoubleMaxWriteRequestUnitsoptional*float64#
The maximum write request units for the global secondary index.

Default: on-demand throughput is disabled

Can only be provided if table billingMode is PAY_PER_REQUEST.

nonKeyAttributesoptionalstring[]non_key_attributesoptionaltyping.List[str]nonKeyAttributesoptionalList<String>NonKeyAttributesoptionalstring[]NonKeyAttributesoptional*[]*string#
The non-key attributes that are projected into the secondary index.

Default: No additional attributes

partitionKeyoptionalAttributepartition_keyoptionalAttributepartitionKeyoptionalAttributePartitionKeyoptionalAttributePartitionKeyoptionalAttribute#
Partition key attribute definition.

Default: exactly one of partitionKey and partitionKeys must be specified.

If a single field forms the partition key, you can use this field. Use the partitionKeys field if the partition key is a multi-attribute key (consists of multiple fields).

partitionKeysoptionalAttribute[]partition_keysoptionaltyping.List[Attribute]partitionKeysoptionalList<Attribute>PartitionKeysoptionalAttribute[]PartitionKeysoptional*[]Attribute#
Multi-attribute partition key.

Default: exactly one of partitionKey and partitionKeys must be specified.

notes

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 multi-attribute 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.

projectionTypeoptionalProjectionTypeprojection_typeoptionalProjectionTypeprojectionTypeoptionalProjectionTypeProjectionTypeoptionalProjectionTypeProjectionTypeoptionalProjectionType= ALL#
The set of attributes that are projected into the secondary index.
readCapacityoptionalnumberread_capacityoptionalint | floatreadCapacityoptionalNumberReadCapacityoptionaldoubleReadCapacityoptional*float64= 5#
The read capacity for the global secondary index.

Can only be provided if table billingMode is Provisioned or undefined.

sortKeyoptionalAttributesort_keyoptionalAttributesortKeyoptionalAttributeSortKeyoptionalAttributeSortKeyoptionalAttribute#
Sort key attribute definition.

Default: no sort key

If a single field forms the sort key, you can use this field. Use the sortKeys field if the sort key is a multi-attribute key (consists of multiple fields).

sortKeysoptionalAttribute[]sort_keysoptionaltyping.List[Attribute]sortKeysoptionalList<Attribute>SortKeysoptionalAttribute[]SortKeysoptional*[]Attribute#
Multi-attribute sort key.

Default: no sort key

notes

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 multi-attribute 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!

warmThroughputoptionalWarmThroughputwarm_throughputoptionalWarmThroughputwarmThroughputoptionalWarmThroughputWarmThroughputoptionalWarmThroughputWarmThroughputoptionalWarmThroughput#
The warm throughput configuration for the global secondary index.

Default: no warm throughput is configured

writeCapacityoptionalnumberwrite_capacityoptionalint | floatwriteCapacityoptionalNumberWriteCapacityoptionaldoubleWriteCapacityoptional*float64= 5#
The write capacity for the global secondary index.

Can only be provided if table billingMode is Provisioned or undefined.