GlobalSecondaryIndexPropsV2

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

Bases: SecondaryIndexProps

Properties used to configure 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.

  • max_read_request_units (Union[int, float, None]) – The maximum read request units. Note: This can only be configured if the primary table billing is PAY_PER_REQUEST. Default: - inherited from the primary table.

  • max_write_request_units (Union[int, float, None]) – The maximum write request units. Note: This can only be configured if the primary table billing is PAY_PER_REQUEST. Default: - inherited from the primary table.

  • read_capacity (Optional[Capacity]) – The read capacity. Note: This can only be configured if the primary table billing is provisioned. Default: - inherited from the primary table.

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

  • write_capacity (Optional[Capacity]) – The write capacity. Note: This can only be configured if the primary table billing is provisioned. Default: - inherited from the primary table.

ExampleMetadata:

infused

Example:

table = dynamodb.TableV2(self, "Table",
    partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING),
    global_secondary_indexes=[dynamodb.GlobalSecondaryIndexPropsV2(
        index_name="gsi1",
        partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING)
    )
    ]
)

table.add_global_secondary_index(
    index_name="gsi2",
    partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING)
)

Attributes

index_name

The name of the secondary index.

max_read_request_units

The maximum read request units.

Note: This can only be configured if the primary table billing is PAY_PER_REQUEST.

Default:
  • inherited from the primary table.

max_write_request_units

The maximum write request units.

Note: This can only be configured if the primary table billing is PAY_PER_REQUEST.

Default:
  • inherited from the primary table.

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.

Note: This can only be configured if the primary table billing is provisioned.

Default:
  • inherited from the primary table.

sort_key

Sort key attribute definition.

Default:
  • no sort key

write_capacity

The write capacity.

Note: This can only be configured if the primary table billing is provisioned.

Default:
  • inherited from the primary table.