S3 Batch Operations¶
When the batch job starts, Amazon S3 invokes the Lambda function synchronously for each object in the manifest. The event parameter includes the names of the bucket and the object.
Request¶
Example Amazon S3 batch request event
{
"invocationSchemaVersion": "1.0",
"invocationId": "YXNkbGZqYWRmaiBhc2RmdW9hZHNmZGpmaGFzbGtkaGZza2RmaAo",
"job": {
"id": "f3cc4f60-61f6-4a2b-8a21-d07600c373ce"
},
"tasks": [
{
"taskId": "dGFza2lkZ29lc2hlcmUK",
"s3Key": "customerImage1.jpg",
"s3VersionId": "1",
"s3BucketArn": "arn:aws:s3:us-east-1:0123456788:examplebucket"
}
]
}
Response¶
resultCodeis the result of the Lambda function.Succeeded,TemporaryFailureorPermanentFailure
Example Amazon S3 batch response
{
"invocationSchemaVersion": "1.0",
"treatMissingKeysAs" : "PermanentFailure",
"invocationId" : "YXNkbGZqYWRmaiBhc2RmdW9hZHNmZGpmaGFzbGtkaGZza2RmaAo",
"results": [
{
"taskId": "dGFza2lkZ29lc2hlcmUK",
"resultCode": "Succeeded",
"resultString": "["Alice", "Bob"]"
}
]
}
Resources¶
- S3 Batch - Typescript - NPM
@types/aws-lambda - S3 Batch - Go -
github.com/aws/aws-lambda-go/events - S3BatchEvent - Java - Maven
aws-lambda-java-events - S3BatchJobEvent - Crate
aws-lambda-events - The
serverless-s3-batchplugin is designed to make it easy to work with S3 Batch operations. NPMserverless-s3-batch