GlobalSecondaryIndexProps

class aws_cdk.aws_dynamodb.GlobalSecondaryIndexProps(*, index_name, non_key_attributes=None, projection_type=None, partition_key=None, sort_key=None, contributor_insights_enabled=None, contributor_insights_specification=None, max_read_request_units=None, max_write_request_units=None, partition_keys=None, read_capacity=None, sort_keys=None, warm_throughput=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], None]) – Partition key attribute definition. If a single field forms the partition key, you can use this field. Use the partitionKeys field if the partition key is a compound key (consists of multiple fields). Default: - exactly one of partitionKey and partitionKeys must be specified.

  • sort_key (Union[Attribute, Dict[str, Any], None]) – Sort key attribute definition. If a single field forms the sort key, you can use this field. Use the sortKeys field if the sort key is a compound key (consists of multiple fields). Default: - no sort key

  • contributor_insights_enabled (Optional[bool]) – (deprecated) Whether CloudWatch contributor insights is enabled for the specified global secondary index. Default: false

  • contributor_insights_specification (Union[ContributorInsightsSpecification, Dict[str, Any], None]) – Whether CloudWatch contributor insights is enabled and what mode is selected. Default: - contributor insights is not enabled

  • max_read_request_units (Union[int, float, None]) – The maximum read request units for the global secondary index. Can only be provided if table billingMode is PAY_PER_REQUEST. Default: - on-demand throughput is disabled

  • max_write_request_units (Union[int, float, None]) – The maximum write request units for the global secondary index. Can only be provided if table billingMode is PAY_PER_REQUEST. Default: - on-demand throughput is disabled

  • partition_keys (Optional[Sequence[Union[Attribute, Dict[str, Any]]]]) – Compound partition key. If a single field forms the partition key, you can use either partitionKey or partitionKeys to specify the partition key. Exactly one of these must be specified. You must use partitionKeys field if the partition key is a compound key (consists of multiple fields). NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields. The order of fields is not important. Default: - exactly one of partitionKey and partitionKeys must be specified.

  • 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

  • sort_keys (Optional[Sequence[Union[Attribute, Dict[str, Any]]]]) – Compound sort key. If a single field forms the sort key, you can use either sortKey or sortKeys to specify the sort key. At most one of these may be specified. You must use sortKeys field if the sort key is a compound key (consists of multiple fields). NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields at the same time. NOTE: The order of fields is important! Default: - no sort key

  • warm_throughput (Union[WarmThroughput, Dict[str, Any], None]) – The warm throughput configuration for the global secondary index. Default: - no warm throughput is configured

  • 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:

infused

Example:

table = dynamodb.Table(self, "Table",
    partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING),
    contributor_insights_specification=dynamodb.ContributorInsightsSpecification( # for a table
        enabled=True,
        mode=dynamodb.ContributorInsightsMode.THROTTLED_KEYS)
)

table.add_global_secondary_index(
    contributor_insights_specification=dynamodb.ContributorInsightsSpecification( # for a specific global secondary index
        enabled=True),
    index_name="gsi",
    partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING)
)

Attributes

contributor_insights_enabled

(deprecated) Whether CloudWatch contributor insights is enabled for the specified global secondary index.

Default:

false

Deprecated:

use contributorInsightsSpecification instead

Stability:

deprecated

contributor_insights_specification

Whether CloudWatch contributor insights is enabled and what mode is selected.

Default:
  • contributor insights is not enabled

index_name

The name of the secondary index.

max_read_request_units

The maximum read request units for the global secondary index.

Can only be provided if table billingMode is PAY_PER_REQUEST.

Default:
  • on-demand throughput is disabled

max_write_request_units

The maximum write request units for the global secondary index.

Can only be provided if table billingMode is PAY_PER_REQUEST.

Default:
  • on-demand throughput is disabled

non_key_attributes

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

Default:
  • No additional attributes

partition_key

Partition key attribute definition.

If a single field forms the partition key, you can use this field. Use the partitionKeys field if the partition key is a compound key (consists of multiple fields).

Default:
  • exactly one of partitionKey and partitionKeys must be specified.

partition_keys

Compound partition key.

If a single field forms the partition key, you can use either partitionKey or partitionKeys to specify the partition key. Exactly one of these must be specified.

You must use partitionKeys field if the partition key is a compound key (consists of multiple fields).

NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields.

The order of fields is not important.

Default:
  • exactly one of partitionKey and partitionKeys must be specified.

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.

If a single field forms the sort key, you can use this field. Use the sortKeys field if the sort key is a compound key (consists of multiple fields).

Default:
  • no sort key

sort_keys

Compound sort key.

If a single field forms the sort key, you can use either sortKey or sortKeys to specify the sort key. At most one of these may be specified.

You must use sortKeys field if the sort key is a compound key (consists of multiple fields).

NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields at the same time.

NOTE: The order of fields is important!

Default:
  • no sort key

warm_throughput

The warm throughput configuration for the global secondary index.

Default:
  • no warm throughput is configured

write_capacity

The write capacity for the global secondary index.

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

Default:

5