interface SelfManagedKafkaEventSourceProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Lambda.EventSources.SelfManagedKafkaEventSourceProps |
![]() | software.amazon.awscdk.services.lambda.eventsources.SelfManagedKafkaEventSourceProps |
![]() | aws_cdk.aws_lambda_event_sources.SelfManagedKafkaEventSourceProps |
![]() | @aws-cdk/aws-lambda-event-sources » SelfManagedKafkaEventSourceProps |
Properties for a self managed Kafka cluster event source.
If your Kafka cluster is only reachable via VPC make sure to configure it.
Example
import { Secret } from '@aws-cdk/aws-secretsmanager';
import { SelfManagedKafkaEventSource } from '@aws-cdk/aws-lambda-event-sources';
// The list of Kafka brokers
const bootstrapServers = ['kafka-broker:9092'];
// The Kafka topic you want to subscribe to
const topic = 'some-cool-topic';
// The secret that allows access to your self hosted Kafka cluster
declare const secret: Secret;
declare const myFunction: lambda.Function;
myFunction.addEventSource(new SelfManagedKafkaEventSource({
bootstrapServers: bootstrapServers,
topic: topic,
secret: secret,
batchSize: 100, // default
startingPosition: lambda.StartingPosition.TRIM_HORIZON,
}));
Properties
Name | Type | Description |
---|---|---|
bootstrap | string[] | The list of host and port pairs that are the addresses of the Kafka brokers in a "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap itself. |
starting | Starting | Where to begin consuming the stream. |
topic | string | The Kafka topic to subscribe to. |
authentication | Authentication | The authentication method for your Kafka cluster. |
batch | number | The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. |
enabled? | boolean | If the stream event source mapping should be enabled. |
max | Duration | The maximum amount of time to gather records before invoking the function. |
secret? | ISecret | The secret with the Kafka credentials, see https://docs.aws.amazon.com/msk/latest/developerguide/msk-password.html for details This field is required if your Kafka brokers are accessed over the Internet. |
security | ISecurity | If your Kafka brokers are only reachable via VPC, provide the security group here. |
vpc? | IVpc | If your Kafka brokers are only reachable via VPC provide the VPC here. |
vpc | Subnet | If your Kafka brokers are only reachable via VPC, provide the subnets selection here. |
bootstrapServers
Type:
string[]
The list of host and port pairs that are the addresses of the Kafka brokers in a "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap itself.
They are in the format abc.xyz.com:xxxx
.
startingPosition
Type:
Starting
Where to begin consuming the stream.
topic
Type:
string
The Kafka topic to subscribe to.
authenticationMethod?
Type:
Authentication
(optional, default: AuthenticationMethod.SASL_SCRAM_512_AUTH)
The authentication method for your Kafka cluster.
batchSize?
Type:
number
(optional, default: 100)
The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.
Your function receives an event with all the retrieved records.
Valid Range:
- Minimum value of 1
- Maximum value of:
- 1000 for {@link DynamoEventSource}
- 10000 for {@link KinesisEventSource}, {@link ManagedKafkaEventSource} and {@link SelfManagedKafkaEventSource}
enabled?
Type:
boolean
(optional, default: true)
If the stream event source mapping should be enabled.
maxBatchingWindow?
Type:
Duration
(optional, default: Duration.seconds(0))
The maximum amount of time to gather records before invoking the function.
Maximum of Duration.minutes(5)
secret?
Type:
ISecret
(optional, default: none)
The secret with the Kafka credentials, see https://docs.aws.amazon.com/msk/latest/developerguide/msk-password.html for details This field is required if your Kafka brokers are accessed over the Internet.
securityGroup?
Type:
ISecurity
(optional, default: none, required if setting vpc)
If your Kafka brokers are only reachable via VPC, provide the security group here.
vpc?
Type:
IVpc
(optional, default: none)
If your Kafka brokers are only reachable via VPC provide the VPC here.
vpcSubnets?
Type:
Subnet
(optional, default: none, required if setting vpc)
If your Kafka brokers are only reachable via VPC, provide the subnets selection here.