Skip to content
v2.276.0

SecondaryIndexProps Struct ​

Properties for a 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 secondaryIndexProps: dynamodb.SecondaryIndexProps = {
  indexName: 'indexName',

  // the properties below are optional
  nonKeyAttributes: ['nonKeyAttributes'],
  projectionType: dynamodb.ProjectionType.KEYS_ONLY,
};
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

secondary_index_props = dynamodb.SecondaryIndexProps(
    index_name="indexName",

    # the properties below are optional
    non_key_attributes=["nonKeyAttributes"],
    projection_type=dynamodb.ProjectionType.KEYS_ONLY
)
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.*;

SecondaryIndexProps secondaryIndexProps = SecondaryIndexProps.builder()
        .indexName("indexName")

        // the properties below are optional
        .nonKeyAttributes(List.of("nonKeyAttributes"))
        .projectionType(ProjectionType.KEYS_ONLY)
        .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 secondaryIndexProps = new SecondaryIndexProps {
    IndexName = "indexName",

    // the properties below are optional
    NonKeyAttributes = new [] { "nonKeyAttributes" },
    ProjectionType = ProjectionType.KEYS_ONLY
};
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"

secondaryIndexProps := &SecondaryIndexProps{
	IndexName: jsii.String("indexName"),

	// the properties below are optional
	NonKeyAttributes: []*string{
		jsii.String("nonKeyAttributes"),
	},
	ProjectionType: awscdk.Aws_dynamodb.ProjectionType_KEYS_ONLY,
}

Properties ​

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

projectionTypeoptionalProjectionTypeprojection_typeoptionalProjectionTypeprojectionTypeoptionalProjectionTypeProjectionTypeoptionalProjectionTypeProjectionTypeoptionalProjectionType= ALL#
The set of attributes that are projected into the secondary index.