# LocalSecondaryIndexProps

Properties for a local secondary index.

Extends: LocalSecondaryIndexProps
Extends: SecondaryIndexProps

- Source: [`aws-dynamodb/lib/shared.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-dynamodb/lib/shared.ts#L353)

## 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

- `indexName`: string (required) — The name of the secondary index.

- `nonKeyAttributes`: string[] — The non-key attributes that are projected into the secondary index.

  **Default:** No additional attributes

- `projectionType`: [ProjectionType](/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.ProjectionType.html) = ALL — The set of attributes that are projected into the secondary index.

- `sortKey`: [Attribute](/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.Attribute.html) (required) — The attribute of a sort key for the local secondary index.
