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 SAM generates an AWS::Lambda::EventSourceMapping resource when this event type is set.
To declare this entity in your AWS Serverless Application Model (AWS SAM) template, use the following syntax.
[StartingPosition](#sam-function-msk-startingposition): String
[Stream](#sam-function-msk-stream): String
[Topics](#sam-function-msk-topics): List
StartingPosition
The position in a stream from which to start reading.
Valid values: TRIM_HORIZON
or LATEST
Type: String
Required: Yes
AWS CloudFormation compatibility: This property is passed directly to the [StartingPosition](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingposition)
property of an AWS::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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-eventsourcearn)
property of an AWS::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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-topics)
property of an AWS::Lambda::EventSourceMapping
resource.
The following is an example of an MSK
event source type for an Amazon MSK cluster that already exists in an AWS account.
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
The following is an example of an MSK
event source type for an Amazon MSK cluster that is declared in the same template file.
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