用自定义唯一 ID 替换 cloudwatch 请求 ID

replace the cloudwatch request id with a custom unique id

我想向我的 cloudwatch 事件发送一个唯一 ID。
下图显示了请求 ID。必须更改此唯一 ID。

下面是我的 lambda 函数的 serverless.yml 代码。
我尝试添加一个输入 (InputTransformers),但效果不佳。
我可以在这里做什么???

functions:
  stream-function:
    handler: src/stream-handler/stream.handler
    memorySize: 1024 #in MB, also control CPU throughput
    timeout: 31 #in seconds, match with downstream to avoid concurrent request
    events:
      - stream:
          type: kinesis
          arn:
            Fn::GetAtt: [HagoStream, Arn]
          batchSize: 1
          parallelizationFactor: 2
          Id: "my cloud watch rule name"
          InputTransformer: {
               InputTemplate: '{"uniqueId": "96c80428-14fe-c8d0-f6e3-639384992391"}',
                InputPathsMap: {
                  id: '$.uniqueId'
                }
            }
          maximumRetryAttempts: 2
          destinations:
            onFailure:
              arn:
                Fn::GetAtt: [HagoFailedQueue, Arn]
              type: sqs

    environment:
      DLQ_URL:
        Ref: HagoDlqQueue

这是 AWS 为您的 lambda 函数调用分配的 unique ID。你不能改变它。

RequestId – The unique request ID for the invocation.

相反,在您的函数代码中,您可以生成一些额外的 ID,您在 CloudWatch Logs 中输出这些 ID 以及您的其他数据。