如何在无服务器中为跨区域s3事件配置lambda函数?

问题描述

我在us-east-1中有一个名为secrets的S3存储桶

所有lambda函数都在ap-south-1中。我想创建一个lambda函数,该函数secrets存储桶上的每次写操作中都会触发。我的serverless.yml文件看起来像...

...
...

provider:
  name: aws
  runtime: python3.7
  region: ap-south-1

functions:
  secrets-update:
    handler: handler.secrets_update
    timeout: 60
    events:
      - s3:
          bucket: secrets
          event: s3:ObjectCreated:*
          rules:
            - prefix: production/
          existing: true
  ...
  ...

在部署它时,出现以下错误

Failed to create resource. The notification destination service region is not valid for the bucket location constraint See details in CloudWatch Log: 2020/08/17/[$LATEST]5e7b356....

如果我正确理解,则会显示一条消息,指示存储分区的位置应为ap-south-1,而不是us-east-1

将存储桶移至ap-south-1一个明显的解决方案,但我想知道是否有可能在serverless.yml文件的lambda函数events部分中配置S3存储桶区域。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)