Skip to content
v2.274.0

LocalSecondaryIndexProps Struct ​

Properties for a local secondary index.

Example ​

ts
const table = new dynamodb.TableV2(this, 'Table', {
  partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
  sortKey: { name: 'sk', type: dynamodb.AttributeType.NUMBER },
  localSecondaryIndexes: [
    {
      indexName: 'lsi1',
      sortKey: { name: 'sk', type: dynamodb.AttributeType.NUMBER },
    },
  ],
});

table.addLocalSecondaryIndex({
  indexName: 'lsi2',
  sortKey: { name: 'sk', type: dynamodb.AttributeType.NUMBER },
});

Properties ​

indexNamestringindex_namestrindexNameStringIndexNamestringIndexName*stringrequired#
The name of the secondary index.
nonKeyAttributesstring[]non_key_attributestyping.List[str]nonKeyAttributesList<String>NonKeyAttributesstring[]NonKeyAttributes*[]*string= No additional attributes#
The non-key attributes that are projected into the secondary index.
projectionTypeProjectionTypeprojection_typeProjectionTypeprojectionTypeProjectionTypeProjectionTypeProjectionTypeProjectionTypeProjectionType= ALL#
The set of attributes that are projected into the secondary index.
sortKeyAttributesort_keyAttributesortKeyAttributeSortKeyAttributeSortKeyAttributerequired#
The attribute of a sort key for the local secondary index.