# KinesisConsumerEventSource

Use an Amazon Kinesis stream consumer as an event source for AWS Lambda.

Extends: StreamEventSource › KinesisConsumerEventSource
Implements: IEventSource

- Source: [`aws-lambda-event-sources/lib/kinesis.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-lambda-event-sources/lib/kinesis.ts#L97)
- Type last changed: v2.180.0 · 21 Feb 2025

## Example

```ts
import * as kinesis from 'aws-cdk-lib/aws-kinesis';
import { KinesisConsumerEventSource } from 'aws-cdk-lib/aws-lambda-event-sources';

const stream = new kinesis.Stream(this, 'MyStream');
const streamConsumer = new kinesis.StreamConsumer(this, 'MyStreamConsumer', {
  stream,
  streamConsumerName: 'MyStreamConsumer',
});

declare const myFunction: lambda.Function;
myFunction.addEventSource(new KinesisConsumerEventSource(streamConsumer, {
  batchSize: 100, // default
  startingPosition: lambda.StartingPosition.TRIM_HORIZON,
}));
```

## Initializer

```ts
new KinesisConsumerEventSource(streamConsumer: IStreamConsumer, props: KinesisEventSourceProps)
```

## Properties

- `eventSourceMappingArn`: string — The ARN for this EventSourceMapping.

- `eventSourceMappingId`: string — The identifier for this EventSourceMapping.

- `streamConsumer`: [IStreamConsumer](/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.IStreamConsumer.html)

## Methods

- `bind(target: IFunction): void` — Called by `lambda.addEventSource` to allow the event source to bind to this function.
