简体   繁体   English

用于 Lambda/Kinesis 事件源映射的 Cloudformation `StartingPositionTimestamp`

[英]Cloudformation `StartingPositionTimestamp` for Lambda/Kinesis event source mapping

I'm looking to connect a Kinesis stream to a Lambda function via event source mapping, want to set the StartingPosition value to AT_TIMESTAMP -我希望通过事件源映射将 Kinesis 流连接到 Lambda 函数,希望将StartingPosition值设置为AT_TIMESTAMP -

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingposition https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-startingposition

So now I'm looking to set the actual timestamp for that starting position.所以现在我想为那个起始位置设置实际的时间戳。

If I look at the AWS CLI there seems to be a parameter for it ( --starting-position-timestamp ) -如果我查看 AWS CLI,似乎有一个参数( --starting-position-timestamp )-

aws lambda create-event-source-mapping help
SYNOPSIS
            create-event-source-mapping
          --event-source-arn <value>
          --function-name <value>
          [--enabled | --no-enabled]
          [--batch-size <value>]
          [--starting-position <value>]
          [--starting-position-timestamp <value>]
          [--cli-input-json <value>]
          [--generate-cli-skeleton <value>]

and if I look at boto3 there is a StartingPositionTimestamp parameter -如果我看一下boto3有一个StartingPositionTimestamp参数 -

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.create_event_source_mapping https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.create_event_source_mapping

response = client.create_event_source_mapping(
    EventSourceArn='string',
    FunctionName='string',
    Enabled=True|False,
    BatchSize=123,
    StartingPosition='TRIM_HORIZON'|'LATEST'|'AT_TIMESTAMP',
    StartingPositionTimestamp=datetime(2015, 1, 1)
)

but I can't find any such StartingPositionTimestamp parameter in the AWS::Lambda::EventSourceMapping docs -但我在AWS::Lambda::EventSourceMapping文档中找不到任何这样的StartingPositionTimestamp参数 -

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html

So how do I set Kinesis starting position timestamp via Cloudformation ?那么如何通过 Cloudformation 设置 Kinesis 起始位置时间戳?

Great question, and I'm stuck with this myself.很好的问题,我自己也被困住了。 Not just "How do I specify the timestamp in the CloudFormation template?"不仅仅是“如何在 CloudFormation 模板中指定时间戳?” , but obviously "How do I update the timestamp that the EventSourceMapping uses?" ,但显然“我如何更新 EventSourceMapping 使用的时间戳?”

This isn't really a static property so doesn't lend itself to CloudFormation.这并不是真正的静态属性,因此不适用于 CloudFormation。

I'm guessing here, but maybe you should update the timestamp as part of your process.我在这里猜测,但也许您应该在过程中更新时间戳。 Bootstrap your app by setting timestamp as epoch, and then after reading your stream set it to the timestamp of the last processed element.通过将时间戳设置为纪元来引导您的应用程序,然后在读取流后将其设置为最后处理元素的时间戳。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kinesis 事件源映射中的 ParallelizationFactor - ParallelizationFactor in kinesis event source mapping 通过 cloudformation 的 AWS Lambda 计划事件源 - AWS Lambda scheduled event source via cloudformation 按 lambda 过滤运动事件 - filter kinesis event by lambda 无法使用CloudFormation在Lambda函数上创建SNS事件源 - Can't create a SNS Event source on a Lambda function using CloudFormation 错误创建 Lambda 事件源映射 (): InvalidParameterValueException: 无法识别的事件源 - error creating Lambda Event Source Mapping (): InvalidParameterValueException: Unrecognized event source 带有 Kinesis 事件使用者的 AWS CloudFormation 模板 - AWS CloudFormation template with Kinesis Event Consumer 如何在CloudFormation中将目标设置为Lambda以进行AWS Kinesis数据分析 - How to set destination as lambda in cloudformation for aws kinesis data analytics AWS Lambda:创建事件源映射时出错:配置模糊定义 - AWS Lambda: error creating the event source mapping: Configuration is ambiguously defined 使用AWS Lambda / CloudFormation在AWS Kinesis Firehose中转换数据 - Transforming data in AWS Kinesis Firehose with AWS Lambda / CloudFormation AWS - 如何为 fifo lambda 创建事件源映射? - AWS - How can I create event source mapping for fifo lambda?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM