LocalSecondaryIndexProps

class aws_cdk.aws_dynamodb.LocalSecondaryIndexProps(*, index_name, non_key_attributes=None, projection_type=None, sort_key)

Bases: SecondaryIndexProps

Properties for a local secondary index.

Parameters:
  • index_name (str) – The name of the secondary index.

  • non_key_attributes (Optional[Sequence[str]]) – The non-key attributes that are projected into the secondary index. Default: - No additional attributes

  • projection_type (Optional[ProjectionType]) – The set of attributes that are projected into the secondary index. Default: ALL

  • sort_key (Union[Attribute, Dict[str, Any]]) – The attribute of a sort key for the local secondary index.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_dynamodb as dynamodb

local_secondary_index_props = dynamodb.LocalSecondaryIndexProps(
    index_name="indexName",
    sort_key=dynamodb.Attribute(
        name="name",
        type=dynamodb.AttributeType.BINARY
    ),

    # the properties below are optional
    non_key_attributes=["nonKeyAttributes"],
    projection_type=dynamodb.ProjectionType.KEYS_ONLY
)

Attributes

index_name

The name of the secondary index.

non_key_attributes

The non-key attributes that are projected into the secondary index.

Default:
  • No additional attributes

projection_type

The set of attributes that are projected into the secondary index.

Default:

ALL

sort_key

The attribute of a sort key for the local secondary index.