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

问题描述 投票:2回答:1

我正在通过事件源映射将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)
)

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

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

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

amazon-web-services aws-lambda amazon-cloudformation amazon-kinesis
1个回答
0
投票

很好的问题,我自己一直坚持下去。不仅是“如何在CloudFormation模板中指定时间戳?”,而且显然是“如何更新EventSourceMapping使用的时间戳?”

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

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

© www.soinside.com 2019 - 2024. All rights reserved.