enum StartingPosition
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Lambda.StartingPosition |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awslambda#StartingPosition |
Java | software.amazon.awscdk.services.lambda.StartingPosition |
Python | aws_cdk.aws_lambda.StartingPosition |
TypeScript (source) | aws-cdk-lib » aws_lambda » StartingPosition |
The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.
Example
import { ManagedKafkaEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';
import { Key } from 'aws-cdk-lib/aws-kms';
// Your MSK cluster arn
const clusterArn = 'arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4';
// The Kafka topic you want to subscribe to
const topic = 'some-cool-topic';
// Your self managed KMS key
const myKey = Key.fromKeyArn(
this,
'SourceBucketEncryptionKey',
'arn:aws:kms:us-east-1:123456789012:key/<key-id>',
);
declare const myFunction: lambda.Function;
myFunction.addEventSource(new ManagedKafkaEventSource({
clusterArn,
topic,
startingPosition: lambda.StartingPosition.TRIM_HORIZON,
filters: [
lambda.FilterCriteria.filter({
stringEquals: lambda.FilterRule.isEqual('test'),
}),
],
filterEncryption: myKey,
}));
Members
| Name | Description |
|---|---|
| TRIM_HORIZON | Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard. |
| LATEST | Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard. |
| AT_TIMESTAMP | Start reading from a position defined by a time stamp. |
TRIM_HORIZON
Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.
LATEST
Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard.
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.

.NET
Go
Java
Python
TypeScript (