StartingPosition
- class aws_cdk.aws_lambda.StartingPosition(*values)
Bases:
Enum
The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.
- ExampleMetadata:
infused
Example:
from aws_cdk.aws_lambda_event_sources import ManagedKafkaEventSource from aws_cdk.aws_kms import Key # my_function: lambda.Function # Your MSK cluster arn cluster_arn = "arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4" # The Kafka topic you want to subscribe to topic = "some-cool-topic" # Your self managed KMS key my_key = Key.from_key_arn(self, "SourceBucketEncryptionKey", "arn:aws:kms:us-east-1:123456789012:key/<key-id>") my_function.add_event_source(ManagedKafkaEventSource( cluster_arn=cluster_arn, topic=topic, starting_position=lambda_.StartingPosition.TRIM_HORIZON, filters=[ lambda_.FilterCriteria.filter({ "string_equals": lambda_.FilterRule.is_equal("test") }) ], filter_encryption=my_key ))
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.