Skip to content
v2.273.0

StreamViewType Enum ​

When an item in the table is modified, StreamViewType determines what information is written to the stream for this table.

Example ​

ts
import * as eventsources from 'aws-cdk-lib/aws-lambda-event-sources';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';

declare const fn: lambda.Function;
const table = new dynamodb.Table(this, 'Table', {
  partitionKey: {
    name: 'id',
    type: dynamodb.AttributeType.STRING,
  },
  stream: dynamodb.StreamViewType.NEW_IMAGE,
});

fn.addEventSource(new eventsources.DynamoEventSource(table, {
  startingPosition: lambda.StartingPosition.LATEST,
  metricsConfig: {
    metrics: [lambda.MetricType.EVENT_COUNT],
  }
}));

Members ​

MemberDescription
NEW_IMAGEThe entire item, as it appears after it was modified, is written to the stream.
OLD_IMAGEThe entire item, as it appeared before it was modified, is written to the stream.
NEW_AND_OLD_IMAGESBoth the new and the old item images of the item are written to the stream.
KEYS_ONLYOnly the key attributes of the modified item are written to the stream.

Referenced by ​