gpt4 book ai didi

amazon-web-services - 如何构建 SNS 过滤策略以匹配部分 S3 对象键

转载 作者:行者123 更新时间:2023-12-05 06:37:08 25 4
gpt4 key购买 nike

我已经创建了对 SNS 主题的订阅,其中所有事件都将来自 S3 ObjectCreated:Put 操作。我只想接收 S3 对象键包含字符串“KLWX”的通知。该过滤策略应该是什么样的?通知数据如下,但是“消息”属性值是作为字符串而不是 JSON 对象给出的。为了便于阅读,我只是对其进行了扩展。

{
"SignatureVersion": "1",
"Type": "Notification",
"TopicArn": "xxx",
"Message": {
"Records": [{
"eventVersion": "2.0",
"eventSource": "aws:s3",
"awsRegion": "us-east-1",
"eventTime": "2018-01-18T20:16:27.590Z",
"eventName": "ObjectCreated:Put",
"userIdentity": {
"principalId": "xxx"
},
"requestParameters": {
"sourceIPAddress": "xxx"
},
"responseElements": {
"x-amz-request-id": "6CF3314E6D6B7671",
"x-amz-id-2": "tJdr3KDcAsp1tuGdo6y4jBLkYXsEDEeVPcvQ1SWQoLXWsZL81WUzbloDe1HxbhGes4u0tY9Jh+g="
},
"s3": {
"s3SchemaVersion": "1.0",
"configurationId": "NewNEXRADLevel2Object",
"bucket": {
"name": "xxx",
"ownerIdentity": {
"principalId": "xxx"
},
"arn": "xxx"
},
"object": {
"key": "KCBW/881/20180118-201329-015-I",
"size": 16063,
"eTag": "772cd2d2e82b22448792308755891350",
"sequencer": "005A61009B8EC82991"
}
}
}]
},
"UnsubscribeURL": "xxx",
"Signature": "xxx",
"Timestamp": "2018-01-18T20:16:27.626Z",
"SigningCertURL": "xxx",
"Subject": "Amazon S3 Notification",
"MessageId": "ed6a0365-4af2-5497-9be0-51be4829cdee"

最佳答案

您必须在 S3 上执行此操作。创建事件时,您可以使用前缀/后缀的组合来过滤哪个对象将通知发送到您的 SNS 主题。

假设桶名是YourBucket,你的对象键是KCBW/881/20180118-201329-015-I,你必须在YourBucket上配置S3事件使用 prefix = KLWX/

关于amazon-web-services - 如何构建 SNS 过滤策略以匹配部分 S3 对象键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48331277/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com