繁体   English   中英

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

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

我希望通过事件源映射将 Kinesis 流连接到 Lambda 函数,希望将StartingPosition值设置为AT_TIMESTAMP -

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

所以现在我想为那个起始位置设置实际的时间戳。

如果我查看 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>]

如果我看一下boto3有一个StartingPositionTimestamp参数 -

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)
)

但我在AWS::Lambda::EventSourceMapping文档中找不到任何这样的StartingPositionTimestamp参数 -

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

那么如何通过 Cloudformation 设置 Kinesis 起始位置时间戳?

很好的问题,我自己也被困住了。 不仅仅是“如何在 CloudFormation 模板中指定时间戳?” ,但显然“我如何更新 EventSourceMapping 使用的时间戳?”

这并不是真正的静态属性,因此不适用于 CloudFormation。

我在这里猜测,但也许您应该在过程中更新时间戳。 通过将时间戳设置为纪元来引导您的应用程序,然后在读取流后将其设置为最后处理元素的时间戳。

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM