S3事件通知仅将元数据发送到SQS

时间:2019-02-04 05:43:49

标签: amazon-s3 amazon-sqs

试图了解SQS。

我最近启用了一个S3事件,以将数据形式从S3同步到SQS。当我将文件(一些纯文本数据)上传到S3时,我只会在SQS队列中看到(上传到S3的文件的)元数据,而看不到文件中的实际数据。

以下是我从SQS cli获得的回复。

{
"Messages": [{
    "Body": "{\"Records\":[{\"eventVersion\":\"2.1\",\"eventSource\":\"aws:s3\",\"awsRegion\":\"us-west-2\",\"eventTime\":\"2019-02-03T04:20:52.812Z\",\"eventName\":\"ObjectCreated:Put\",\"userIdentity\":{\"principalId\":\"AWS:AROAJPPH7T6UMTQNWQDV4:email@email.com\"},\"requestParameters\":{\"sourceIPAddress\":\"***.***.95.237\"},\"responseElements\":{\"x-amz-request-id\":\"D0FBEB5DD148EC84\",\"x-amz-id-2\":\"F7q+hW5hb6f02J42gT1wWDWjAp2wuQ3ojio1n2Bz/jZCS+e+6/zjkYsUfRNB59dqH61p67rPJDU=\"},\"s3\":{\"s3SchemaVersion\":\"1.0\",\"configurationId\":\"SQS-hops-mab-new-hotelids\",\"bucket\":{\"name\":\"bukcet-name\",\"ownerIdentity\":{\"principalId\":\"A3HAX2MIKOSGAO\"},\"arn\":\"arn:aws:s3:::bukcet-name\"},\"object\":{\"key\":\"prefix/data_file\",\"size\":80,\"eTag\":\"b10063d01db20998584a425f0fa77a29\",\"sequencer\":\"005C566C24C2E9A48A\"}}}]}",
    "ReceiptHandle": "AQEBGIumiawoH/pKK5deThbTsCuZ8bWlgF/p8qiL1VTrDqpkUkVxWUxlzMftEtfRzqFZKx+nyUCjuSb50Oicd7hq51LUexOro0+GTVtQsxJlEJ9RaxIk+7/Ia1Ac7ox2G4Mt1nnFBDiEsiPgwYwbQe0fAz1EFiI3QZuZtOdyPNFAIaObPJGhF591IwSA6xhIqgHYJwo5pvw/axVCd05Ex34wg/TFIN9Ha4RVUSDWFXpBmPtM/1V6Ek6HP/Ag0Ps3HKhG1KNOFUjq0mv6bGqaXI/HuxCGitj3uk0xX25y0lT+RFomWcDyKpbmfm2fue8StABrKE7sm/inc1Zbd/4qKFTNUdPqQVqIr3s55plAPDXGvNiXBx4O7FkrE1jrxHBeONMRrlYHe2/KeL0WaITYu3dxNw==",
    "MD5OfBody": "0c04939f7c38ff3f9992ef911b514ed7",
    "MessageId": "f7fcb7da-66cb-4a59-acf0-79f75e9a60ce"
}]

}

下面是上方 Body 部分中的元数据。

{
"Records": [{
    "eventVersion": "2.1",
    "eventSource": "aws:s3",
    "awsRegion": "us-west-2",
    "eventTime": "2019-02-04T01:00:31.166Z",
    "eventName": "ObjectCreated:Put",
    "userIdentity": {
        "principalId": "AWS:AROAJPPH7T6UMTQNWQDV4:email@****.com"
    },
    "requestParameters": {
        "sourceIPAddress": "***.***.95.237"
    },
    "responseElements": {
        "x-amz-request-id": "24703DDF194A1F7E",
        "x-amz-id-2": "wwpJeU6B3yZT7qaB7imsucsaM8y1hpFBi14POL4L1/2C1/CoBRkdHLgIOPzyy85a3RPJQFfE9Ys="
    },
    "s3": {
        "s3SchemaVersion": "1.0",
        "configurationId": "SQS-name",
        "bucket": {
            "name": "bucket-name",
            "ownerIdentity": {
                "principalId": "A3HAX2MIKOSGAO"
            },
            "arn": "arn:aws:s3:::bucket-name"
        },
        "object": {
            "key": "prefix/datafile",
            "size": 80,
            "eTag": "b10063d01db20998584a425f0fa77a29",
            "sequencer": "005C578EAF156E8A91"
        }
    }
}]

}

S3事件通知是否将实际数据发送到SQS?我想念什么吗?

1 个答案:

答案 0 :(得分:1)

是的,这是正确的,SQS将仅获取正在创建/修改或基于通知事件的S3对象的元数据。无论选择哪种目的地类型,S3通知结构对于所有目的地都是相同的。 S3对象可以是任何音频,视频或一些巨大的JSON文件。 SQS有其limits,并且不能始终接收实际的S3对象。