StartingPosition

class aws_cdk.aws_lambda.StartingPosition(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_kinesis as kinesis
from aws_cdk.aws_lambda_event_sources import KinesisConsumerEventSource

# my_function: lambda.Function


stream = kinesis.Stream(self, "MyStream")
stream_consumer = kinesis.StreamConsumer(self, "MyStreamConsumer",
    stream=stream,
    stream_consumer_name="MyStreamConsumer"
)
my_function.add_event_source(KinesisConsumerEventSource(stream_consumer,
    batch_size=100,  # default
    starting_position=lambda_.StartingPosition.TRIM_HORIZON
))

Attributes

AT_TIMESTAMP

Start reading from a position defined by a time stamp.

Only supported for Amazon Kinesis streams, otherwise an error will occur. If supplied, startingPositionTimestamp must also be set.

LATEST

Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard.

TRIM_HORIZON

Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.