Skip to content
v2.274.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 ​

contributorInsightsEnabledbooleancontributor_insights_enabledboolcontributorInsightsEnabledBooleanContributorInsightsEnabledboolContributorInsightsEnabled*bool= falsedeprecated#
use `contributorInsightsSpecification` instead
contributorInsightsSpecificationContributorInsightsSpecificationcontributor_insights_specificationContributorInsightsSpecificationcontributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecification= contributor insights is not enab…#
Whether CloudWatch contributor insights is enabled and what mode is selected.
default

Default: contributor insights is not enabled

indexNamestringindex_namestrindexNameStringIndexNamestringIndexName*stringrequired#
The name of the secondary index.
maxReadRequestUnitsnumbermax_read_request_unitsint | floatmaxReadRequestUnitsNumberMaxReadRequestUnitsdoubleMaxReadRequestUnits*float64= 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.

maxWriteRequestUnitsnumbermax_write_request_unitsint | floatmaxWriteRequestUnitsNumberMaxWriteRequestUnitsdoubleMaxWriteRequestUnits*float64= 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.

nonKeyAttributesstring[]non_key_attributestyping.List[str]nonKeyAttributesList<String>NonKeyAttributesstring[]NonKeyAttributes*[]*string= No additional attributes#
The non-key attributes that are projected into the secondary index.
partitionKeyAttributepartition_keyAttributepartitionKeyAttributePartitionKeyAttributePartitionKeyAttribute= exactly one of `partitionKey` an…#
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 multi-attribute key (consists of multiple fields).

default

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

partitionKeysAttribute[]partition_keystyping.List[Attribute]partitionKeysList<Attribute>PartitionKeysAttribute[]PartitionKeys*[]Attribute= exactly one of `partitionKey` an…#
Multi-attribute partition key.
notes · default

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.

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

projectionTypeProjectionTypeprojection_typeProjectionTypeprojectionTypeProjectionTypeProjectionTypeProjectionTypeProjectionTypeProjectionType= ALL#
The set of attributes that are projected into the secondary index.
readCapacitynumberread_capacityint | floatreadCapacityNumberReadCapacitydoubleReadCapacity*float64= 5#
The read capacity for the global secondary index.

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

sortKeyAttributesort_keyAttributesortKeyAttributeSortKeyAttributeSortKeyAttribute= 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 multi-attribute key (consists of multiple fields).

sortKeysAttribute[]sort_keystyping.List[Attribute]sortKeysList<Attribute>SortKeysAttribute[]SortKeys*[]Attribute= no sort key#
Multi-attribute 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!

warmThroughputWarmThroughputwarm_throughputWarmThroughputwarmThroughputWarmThroughputWarmThroughputWarmThroughputWarmThroughputWarmThroughput= no warm throughput is configured#
The warm throughput configuration for the global secondary index.
writeCapacitynumberwrite_capacityint | floatwriteCapacityNumberWriteCapacitydoubleWriteCapacity*float64= 5#
The write capacity for the global secondary index.

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