Skip to content
v2.275.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.
nonKeyAttributesoptionalstring[]non_key_attributesoptionaltyping.List[str]nonKeyAttributesoptionalList<String>NonKeyAttributesoptionalstring[]NonKeyAttributesoptional*[]*string#
The non-key attributes that are projected into the secondary index.

Default: No additional attributes

projectionTypeoptionalProjectionTypeprojection_typeoptionalProjectionTypeprojectionTypeoptionalProjectionTypeProjectionTypeoptionalProjectionTypeProjectionTypeoptionalProjectionType= 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.