Rol*_*ger 9 amazon-s3 amazon-sqs amazon-web-services aws-lambda
我想在AWS S3存储桶中设置以下事件/通知配置:收到文件(s3:ObjectCreated:*)后,将触发两个目标:
当我尝试通过AWS控制台设置配置时,我收到以下错误消息:
Configurations overlap. Configurations on the same bucket cannot share a common event type. : s3:ObjectCreated:*, s3:ObjectCreated:*
Run Code Online (Sandbox Code Playgroud)
我尝试按照用户指南的建议通过AWS SDK(Java)设置配置,但结果类似:
Caught an AmazonServiceException, which means your request made it to Amazon S3, but was rejected with an error response for some reason.
Error Message: Configurations overlap. Configurations on the same bucket cannot share a common event type. (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument; Request ID: A0E8738522EA218F)
HTTP Status Code: 400
AWS Error Code: InvalidArgument
Error Type: Client
Request ID: A0E8738522EA218F
Error XML<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidArgument</Code><Message>Configurations overlap. Configurations on the same bucket cannot share a common event type.</Message><ArgumentName>Event</ArgumentName><ArgumentValue>s3:ObjectCreated:*, s3:ObjectCreated:*</ArgumentValue><RequestId>A0E8738522EA218F</RequestId><HostId>p4qYoIXi38u3Jl3p0xpI7TFWgs0ZxsqK89oDTTy8D/tbw39NnaIT99jIvHIxt4XliRFxqNWl32M=</HostId></Error>
Run Code Online (Sandbox Code Playgroud)
实际上,发生此错误是因为您尝试通过不同的函数挂钩同一事件。
转到存储桶的properties选项卡并滚动到Events部分
例如,如果该存储桶上已注册“PUT”事件,则您将无法在其他函数上注册“PUT”事件。
我建议你应该发布S3 Notifications到SNS Topic,有你Lambda function和SQS Queue订阅此SNS Topic.
这种架构应该可以帮助您实现所需的目标.
最佳解决方案可能是在文件上传到S3时触发SNS通知,然后使用SNS的"扇出"功能发送多个,同时发送的SQS消息,然后可以单独接收和执行这些消息.
或者,如果您只想处理"步骤2",当且仅当处理"步骤1"时,您可以为"步骤1"触发单个SQS消息,然后仅在成功完成"步骤1"时触发,让"第1步"的最后一步是为第2步发送"第2步"事件以进行进一步处理.
| 归档时间: |
|
| 查看次数: |
6538 次 |
| 最近记录: |