Skip to content

(@aws-cdk/aws-lambda): add support for AT_TIMESTAMP to lambda kinesis event source mapping #17214

@john-watson-ppl

Description

@john-watson-ppl

Description

Current:
Currently event source mapping for kinesis only supports the following settings in L2 components

  • TRIM_HORIZON ( start of stream )
  • LATEST ( end of stream )

https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-lambda/lib/event-source-mapping.ts#L336

Cloudformation supports the notion of starting kinesis streams from AT_TIMESTAMP:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html

Can we add AT_TIMESTAMP to the enum. This will also need support for an additional field:
StartingPositionTimestamp

Use Case

Replacing kinesis triggers can cause failed events not to reach their maximum retry attempts and end up skipped.

In order to work around this problem replacing triggers with new triggers that point to a time relative to deployment time will help prevent skipped events. TRIM_HORIZON is not an adequate alternative depending on the number of events in the stream and the stream retention settings meaning potentially millions of records need reprocessed.

Proposed Solution

Add AT_TIMESTAMP to event source mapping enum: StartingPosition

Add StartingPositionTimestamp to L1 event source mapping classes
Add StartingPositionTimestamp to L2 event source mapping classes

Other information

It looks like from what I can see that L1 components are also not correctly structured and only have support for a StartingPosition field but it additionally needs StartingPositionTimestamp as supported in the SDK.

I would say that since the CF template supports this setting, CDK should also support it.

https://github.com/aws/aws-sdk-js/blob/master/clients/lambda.d.ts#L791###

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions