Skip to content
v2.277.0

GlobalSecondaryIndexProperty Struct ​

Represents the properties of a global secondary index.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_dynamodb as dynamodb } from 'aws-cdk-lib';
const globalSecondaryIndexProperty: dynamodb.CfnTable.GlobalSecondaryIndexProperty = {
  indexName: 'indexName',
  keySchema: [{
    attributeName: 'attributeName',
    keyType: 'keyType',
  }],
  projection: {
    nonKeyAttributes: ['nonKeyAttributes'],
    projectionType: 'projectionType',
  },

  // the properties below are optional
  contributorInsightsSpecification: {
    enabled: false,

    // the properties below are optional
    mode: 'mode',
  },
  onDemandThroughput: {
    maxReadRequestUnits: 123,
    maxWriteRequestUnits: 123,
  },
  provisionedThroughput: {
    readCapacityUnits: 123,
    writeCapacityUnits: 123,
  },
  warmThroughput: {
    readUnitsPerSecond: 123,
    writeUnitsPerSecond: 123,
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_dynamodb as dynamodb

global_secondary_index_property = dynamodb.CfnTable.GlobalSecondaryIndexProperty(
    index_name="indexName",
    key_schema=[dynamodb.CfnTable.KeySchemaProperty(
        attribute_name="attributeName",
        key_type="keyType"
    )],
    projection=dynamodb.CfnTable.ProjectionProperty(
        non_key_attributes=["nonKeyAttributes"],
        projection_type="projectionType"
    ),

    # the properties below are optional
    contributor_insights_specification=dynamodb.CfnTable.ContributorInsightsSpecificationProperty(
        enabled=False,

        # the properties below are optional
        mode="mode"
    ),
    on_demand_throughput=dynamodb.CfnTable.OnDemandThroughputProperty(
        max_read_request_units=123,
        max_write_request_units=123
    ),
    provisioned_throughput=dynamodb.CfnTable.ProvisionedThroughputProperty(
        read_capacity_units=123,
        write_capacity_units=123
    ),
    warm_throughput=dynamodb.CfnTable.WarmThroughputProperty(
        read_units_per_second=123,
        write_units_per_second=123
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.dynamodb.*;

GlobalSecondaryIndexProperty globalSecondaryIndexProperty = GlobalSecondaryIndexProperty.builder()
        .indexName("indexName")
        .keySchema(List.of(KeySchemaProperty.builder()
                .attributeName("attributeName")
                .keyType("keyType")
                .build()))
        .projection(ProjectionProperty.builder()
                .nonKeyAttributes(List.of("nonKeyAttributes"))
                .projectionType("projectionType")
                .build())

        // the properties below are optional
        .contributorInsightsSpecification(ContributorInsightsSpecificationProperty.builder()
                .enabled(false)

                // the properties below are optional
                .mode("mode")
                .build())
        .onDemandThroughput(OnDemandThroughputProperty.builder()
                .maxReadRequestUnits(123)
                .maxWriteRequestUnits(123)
                .build())
        .provisionedThroughput(ProvisionedThroughputProperty.builder()
                .readCapacityUnits(123)
                .writeCapacityUnits(123)
                .build())
        .warmThroughput(WarmThroughputProperty.builder()
                .readUnitsPerSecond(123)
                .writeUnitsPerSecond(123)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.DynamoDB;

var globalSecondaryIndexProperty = new GlobalSecondaryIndexProperty {
    IndexName = "indexName",
    KeySchema = new [] { new KeySchemaProperty {
        AttributeName = "attributeName",
        KeyType = "keyType"
    } },
    Projection = new ProjectionProperty {
        NonKeyAttributes = new [] { "nonKeyAttributes" },
        ProjectionType = "projectionType"
    },

    // the properties below are optional
    ContributorInsightsSpecification = new ContributorInsightsSpecificationProperty {
        Enabled = false,

        // the properties below are optional
        Mode = "mode"
    },
    OnDemandThroughput = new OnDemandThroughputProperty {
        MaxReadRequestUnits = 123,
        MaxWriteRequestUnits = 123
    },
    ProvisionedThroughput = new ProvisionedThroughputProperty {
        ReadCapacityUnits = 123,
        WriteCapacityUnits = 123
    },
    WarmThroughput = new WarmThroughputProperty {
        ReadUnitsPerSecond = 123,
        WriteUnitsPerSecond = 123
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

globalSecondaryIndexProperty := &GlobalSecondaryIndexProperty{
	IndexName: jsii.String("indexName"),
	KeySchema: []interface{}{
		&KeySchemaProperty{
			AttributeName: jsii.String("attributeName"),
			KeyType: jsii.String("keyType"),
		},
	},
	Projection: &ProjectionProperty{
		NonKeyAttributes: []*string{
			jsii.String("nonKeyAttributes"),
		},
		ProjectionType: jsii.String("projectionType"),
	},

	// the properties below are optional
	ContributorInsightsSpecification: &ContributorInsightsSpecificationProperty{
		Enabled: jsii.Boolean(false),

		// the properties below are optional
		Mode: jsii.String("mode"),
	},
	OnDemandThroughput: &OnDemandThroughputProperty{
		MaxReadRequestUnits: jsii.Number(123),
		MaxWriteRequestUnits: jsii.Number(123),
	},
	ProvisionedThroughput: &ProvisionedThroughputProperty{
		ReadCapacityUnits: jsii.Number(123),
		WriteCapacityUnits: jsii.Number(123),
	},
	WarmThroughput: &WarmThroughputProperty{
		ReadUnitsPerSecond: jsii.Number(123),
		WriteUnitsPerSecond: jsii.Number(123),
	},
}

Properties ​

contributorInsightsSpecificationoptionalIResolvable | CfnTable.ContributorInsightsSpecificationPropertycontributor_insights_specificationoptionaltyping.Union[IResolvable, ContributorInsightsSpecificationProperty]contributorInsightsSpecificationoptionalIResolvableContributorInsightsSpecificationoptionalIResolvableContributorInsightsSpecificationoptionalinterface{}#
The settings used to specify whether to enable CloudWatch Contributor Insights for the global table and define which events to monitor.
indexNamestringindex_namestrindexNameStringIndexNamestringIndexName*stringrequired#
The name of the global secondary index.

The name must be unique among all other indexes on this table.

keySchemaIResolvable | IResolvable | CfnTable.KeySchemaProperty[]key_schematyping.Union[IResolvable, typing.List[typing.Union[IResolvable, KeySchemaProperty]]]keySchemaIResolvableKeySchemaIResolvableKeySchemainterface{}required#
The complete key schema for a global secondary index, which consists of one or more pairs of attribute names and key types: - `HASH` - partition key - `RANGE` - sort key > The partition key of an item is also known as its *hash attribute* .
notes

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.

onDemandThroughputoptionalIResolvable | CfnTable.OnDemandThroughputPropertyon_demand_throughputoptionaltyping.Union[IResolvable, OnDemandThroughputProperty]onDemandThroughputoptionalIResolvableOnDemandThroughputoptionalIResolvableOnDemandThroughputoptionalinterface{}#
The maximum number of read and write units for the specified global secondary index.

If you use this parameter, you must specify MaxReadRequestUnits , MaxWriteRequestUnits , or both. You must use either OnDemandThroughput or ProvisionedThroughput based on your table's capacity mode.

projectionIResolvable | CfnTable.ProjectionPropertyprojectiontyping.Union[IResolvable, ProjectionProperty]projectionIResolvableProjectionIResolvableProjectioninterface{}required#
Represents attributes that are copied (projected) from the table into the global secondary index.

These are in addition to the primary key attributes and index key attributes, which are automatically projected.

provisionedThroughputoptionalIResolvable | CfnTable.ProvisionedThroughputPropertyprovisioned_throughputoptionaltyping.Union[IResolvable, ProvisionedThroughputProperty]provisionedThroughputoptionalIResolvableProvisionedThroughputoptionalIResolvableProvisionedThroughputoptionalinterface{}#
Represents the provisioned throughput settings for the specified global secondary index.
notes

You must use either OnDemandThroughput or ProvisionedThroughput based on your table's capacity mode.

For current minimum and maximum provisioned throughput values, see Service, Account, and Table Quotas in the Amazon DynamoDB Developer Guide .

warmThroughputoptionalIResolvable | CfnTable.WarmThroughputPropertywarm_throughputoptionaltyping.Union[IResolvable, WarmThroughputProperty]warmThroughputoptionalIResolvableWarmThroughputoptionalIResolvableWarmThroughputoptionalinterface{}#
Represents the warm throughput value (in read units per second and write units per second) for the specified secondary index.

If you use this parameter, you must specify ReadUnitsPerSecond , WriteUnitsPerSecond , or both.