[英]Cloudwatch event rule listen to s3 bucket with specific keypath
Is there a way to listen to an s3 bucket but only inside a specific "folder" so for instance if i had a folder named input i would say listen on "s3://bucket-name/folder1/*"?有没有办法收听 s3 存储桶,但只能在特定的“文件夹”内收听,例如,如果我有一个名为 input 的文件夹,我会说在“s3://bucket-name/folder1/*”上收听? Right now it seems that you can only listen to the entire bucket.My issue is that I want to use the same bucket to trigger CloudWatch based on specific key path, and of course all cloudwatch rules will be triggered.现在好像只能听整个bucket。我的问题是我想使用同一个bucket根据特定的key path来触发CloudWatch,当然所有的cloudwatch规则都会被触发。 This is my flow: CloudTrail (monitor s3://bucket/path) -> CloudWatch (will have an Event Rule for any PUT in that s3://bucket/path) trigger-> StepFunction-> LambdaFunctions I also tried to restrict this from CloudWatch role to give permissions only to that specific S3 bucket path without luck.这是我的流程: CloudTrail (monitor s3://bucket/path) -> CloudWatch (将有一个事件规则用于该 s3://bucket/path 中的任何 PUT) trigger-> StepFunction-> LambdaFunctions 我也试图限制这来自 CloudWatch 角色,仅授予对该特定 S3 存储桶路径的权限,而没有运气。 This is my event rule:这是我的活动规则:
{ "source": [ "aws.s3" ], "detail-type": [ "AWS API Call via CloudTrail" ], "detail": { "eventSource": [ "s3.amazonaws.com" ], "eventName": [ "PutObject" ], "requestParameters": { "bucketName": [ " bucketname" ] } } }
Is there any workaround?有什么解决方法吗?
As of the date of this writing, I do not currently know of a way to accomplish ON THE RULE.在撰写本文时,我目前不知道有什么方法可以完成规则。 There could be a workaround on the rule but I have not found it...该规则可能有一个解决方法,但我还没有找到它......
...HOWEVER: This can be accomplished by using CloudTrail
. ...然而:这可以通过使用CloudTrail
来完成。
bucketname/folder1/folder2
Now you have a log trail for that path only.现在您只有该路径的日志跟踪。 The cloudwatch rule, or eventBridge rule, can now specify the bucket, and whatever operations you want to monitor. cloudwatch 规则或 eventBridge 规则现在可以指定存储桶以及您想要监控的任何操作。
try adding尝试添加
"requestParameters": { "bucketName": [ " bucketname" ],"key":["folder1"] }
could be work.可能是工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.