如何在Lambda事件源映射中设置自定义流名称?

时间:2020-06-09 16:34:50

标签: lambda stream config serverless amazon-kinesis

我正在尝试克服无服务器框架的局限性,因为它不支持为lambda事件源映射设置属性MaximumRecordAgeInSeconds。

我最近发送了一个PR,其中包含以下实现:https://github.com/serverless/serverless/pull/7833

但是,与此同时,我正在尝试通过使用serverless.yml extensions部分设置raw属性来扩展资源:

(只是文件的相关部分)

functions:
  main:
    handler: ./src/main.handler
    name: main-lambda-${self:provider.stage}
    runtime: nodejs12.x
    role: ${self:custom.env.AWS_LAMBDA_ROLE}
    events:
      - stream:
          type: kinesis
          arn: ${self:custom.env.AWS_KINESIS_STREAM_ARN}
          batchSize: ${self:custom.env.AWS_LAMBDA_BATCH_SIZE}
          parallelizationFactor: ${self:custom.env.AWS_LAMBDA_PARALLELIZATION_FACTOR}
          startingPosition: LATEST
          maximumRetryAttempts: 10000
          bisectBatchOnFunctionError: true
          enabled: true

resources:
  extensions:
    MainEventSourceMappingKinesisMaindev:
      Properties:
        MaximumRecordAgeInSeconds: ${self:custom.env.AWS_LAMBDA_MAX_RECORD_AGE_SECONDS}

这里的问题是流名称是根据ARN自动生成的,这取决于阶段,因此我无法识别prod阶段的流名称,因为它最终以名称{{1 }}。

有什么方法可以在原始Cloudformation属性部分动态识别该资源?

谢谢!

0 个答案:

没有答案
相关问题