SzS*_*SzS 6 python amazon-s3 amazon-web-services aws-lambda
AWS Lambda处理程序具有签名
def lambda_handler(event, context):
Run Code Online (Sandbox Code Playgroud)
但是,当触发器是S3 Bucket接收put时,我找不到有关事件结构的任何文档
我认为它可能在s3控制台中定义,但在那里找不到.
有人有任何线索吗?
从S3到Lambda函数的事件将采用json格式,如下所示,
{
"Records":[
{
"eventVersion":"2.0",
"eventSource":"aws:s3",
"awsRegion":"us-east-1",
"eventTime":The time, in ISO-8601 format, for example, 1970-01-01T00:00:00.000Z, when S3 finished processing the request,
"eventName":"event-type",
"userIdentity":{
"principalId":"Amazon-customer-ID-of-the-user-who-caused-the-event"
},
"requestParameters":{
"sourceIPAddress":"ip-address-where-request-came-from"
},
"responseElements":{
"x-amz-request-id":"Amazon S3 generated request ID",
"x-amz-id-2":"Amazon S3 host that processed the request"
},
"s3":{
"s3SchemaVersion":"1.0",
"configurationId":"ID found in the bucket notification configuration",
"bucket":{
"name":"bucket-name",
"ownerIdentity":{
"principalId":"Amazon-customer-ID-of-the-bucket-owner"
},
"arn":"bucket-ARN"
},
"object":{
"key":"object-key",
"size":object-size,
"eTag":"object eTag",
"versionId":"object version if bucket is versioning-enabled, otherwise null",
"sequencer": "a string representation of a hexadecimal value used to determine event sequence,
only used with PUTs and DELETEs"
}
}
},
{
// Additional events
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是aws文档的链接,可以指导您.http://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html
Geo*_*ff 2
我认为最简单的方法就是快速实验:
然后您将在日志中看到事件结构 - 它非常不言自明。
| 归档时间: |
|
| 查看次数: |
4610 次 |
| 最近记录: |