GlobalSecondaryIndexProps

class aws_cdk.aws_dynamodb.GlobalSecondaryIndexProps(*, index_name, non_key_attributes=None, projection_type=None, partition_key, sort_key=None, read_capacity=None, write_capacity=None)

Bases: SecondaryIndexProps, SchemaOptions

Properties for a global 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

  • partition_key (Union[Attribute, Dict[str, Any]]) – Partition key attribute definition.

  • sort_key (Union[Attribute, Dict[str, Any], None]) – Sort key attribute definition. Default: no sort key

  • read_capacity (Union[int, float, None]) – The read capacity for the global secondary index. Can only be provided if table billingMode is Provisioned or undefined. Default: 5

  • write_capacity (Union[int, float, None]) – The write capacity for the global secondary index. Can only be provided if table billingMode is Provisioned or undefined. Default: 5

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

global_secondary_index_props = dynamodb.GlobalSecondaryIndexProps(
    index_name="indexName",
    partition_key=dynamodb.Attribute(
        name="name",
        type=dynamodb.AttributeType.BINARY
    ),

    # the properties below are optional
    non_key_attributes=["nonKeyAttributes"],
    projection_type=dynamodb.ProjectionType.KEYS_ONLY,
    read_capacity=123,
    sort_key=dynamodb.Attribute(
        name="name",
        type=dynamodb.AttributeType.BINARY
    ),
    write_capacity=123
)

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

partition_key

Partition key attribute definition.

projection_type

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

Default:

ALL

read_capacity

The read capacity for the global secondary index.

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

Default:

5

sort_key

Sort key attribute definition.

Default:

no sort key

write_capacity

The write capacity for the global secondary index.

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

Default:

5