MSK
The object describing an MSK
event source type. For more information, see
Using AWS Lambda with Amazon MSK in the AWS Lambda Developer Guide.
AWS Serverless Application Model (AWS SAM) generates an AWS::Lambda::EventSourceMapping resource when this event type is set.
Syntax
To declare this entity in your AWS SAM template, use the following syntax.
YAML
ConsumerGroupId:
String
DestinationConfig:DestinationConfig
FilterCriteria:FilterCriteria
KmsKeyArn:String
MaximumBatchingWindowInSeconds:Integer
SourceAccessConfigurations:SourceAccessConfigurations
StartingPosition:String
StartingPositionTimestamp:Double
Stream:String
Topics:List
Properties
-
ConsumerGroupId
-
A string that configures how events will be read from Kafka topics.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
AmazonManagedKafkaConfiguration
property of anAWS::Lambda::EventSourceMapping
resource. -
DestinationConfig
-
A configuration object that specifies the destination of an event after Lambda processes it.
Use this property to specify the destination of failed invocations from the Amazon MSK event source.
Type: DestinationConfig
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
DestinationConfig
property of anAWS::Lambda::EventSourceMapping
resource. -
FilterCriteria
-
A object that defines the criteria that determines whether Lambda should process an event. For more information, see AWS Lambda event filtering in the AWS Lambda Developer Guide.
Type: FilterCriteria
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
FilterCriteria
property of anAWS::Lambda::EventSourceMapping
resource. -
KmsKeyArn
-
The Amazon Resource Name (ARN) of the key to encrypt information related to this event.
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
KmsKeyArn
property of anAWS::Lambda::EventSourceMapping
resource. -
MaximumBatchingWindowInSeconds
-
The maximum amount of time to gather records before invoking the function, in seconds.
Type: Integer
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
MaximumBatchingWindowInSeconds
property of anAWS::Lambda::EventSourceMapping
resource. -
SourceAccessConfigurations
-
An array of the authentication protocol, VPC components, or virtual host to secure and define your event source.
Valid values:
CLIENT_CERTIFICATE_TLS_AUTH
Type: List of SourceAccessConfiguration
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
SourceAccessConfigurations
property of anAWS::Lambda::EventSourceMapping
resource. -
StartingPosition
-
The position in a stream from which to start reading.
-
AT_TIMESTAMP
– Specify a time from which to start reading records. -
LATEST
– Read only new records. -
TRIM_HORIZON
– Process all available records.
Valid values:
AT_TIMESTAMP
|LATEST
|TRIM_HORIZON
Type: String
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
StartingPosition
property of anAWS::Lambda::EventSourceMapping
resource. -
-
StartingPositionTimestamp
-
The time from which to start reading, in Unix time seconds. Define
StartingPositionTimestamp
whenStartingPosition
is specified asAT_TIMESTAMP
.Type: Double
Required: No
AWS CloudFormation compatibility: This property is passed directly to the
StartingPositionTimestamp
property of anAWS::Lambda::EventSourceMapping
resource. -
Stream
-
The Amazon Resource Name (ARN) of the data stream or a stream consumer.
Type: String
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
EventSourceArn
property of anAWS::Lambda::EventSourceMapping
resource. -
Topics
-
The name of the Kafka topic.
Type: List
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the
Topics
property of anAWS::Lambda::EventSourceMapping
resource.
Examples
Amazon MSK Example for Existing Cluster
The following is an example of an MSK
event source type for an Amazon MSK
cluster that already exists in an AWS account.
YAML
Events: MSKEvent: Type: MSK Properties: StartingPosition: LATEST Stream: arn:aws:kafka:us-east-1:012345678012:cluster/exampleClusterName/abcdefab-1234-abcd-5678-cdef0123ab01-2 Topics: - MyTopic
Amazon MSK Example for Cluster Declared in Same Template
The following is an example of an MSK
event source type for an Amazon MSK
cluster that is declared in the same template file.
YAML
Events: MSKEvent: Type: MSK Properties: StartingPosition: LATEST Stream: Ref: MyMskCluster # This must be the name of an MSK cluster declared in the same template file Topics: - MyTopic