We launched the cloudonaut blog in 2015. Since then, we have published 400 articles, 94 podcast episodes, and 103 videos. Our weekly newsletter keeps you up-to-date. Subscribe now!.
Subscribe
Our weekly newsletter keeps you up-to-date. Subscribe now! It's all free.
Amazon S3 Object Lambda offers a way to execute a Lambda function when someone wants to download a file (GetObject) from an S3 bucket. You can implement whatever logic you wish and return any data as the response via the WriteGetObjectResponse API. Keep in mind that the Lambda function must finish within 60 seconds and is called synchronously.
How S3 Object Lambda works
The following figure shows the needed components:
Let’s look at the parts more closely:
S3 Object Lamda Access Point: References your Lambda function and your S3 Access Point. Block Public Access is always enabled.
Lambda function: Invoked when a GetObject request is made to the S3 Object Lambda Access Point.
S3 Access Point: Takes care of the non GetObject requests (such as ListObjects) and serves the pre-signed URL of the original file passed into the Lambda function.
S3 Bucket: Stores the original file (in fact, the original file could be non-existent).
In the following video, I go into more details and share code with you:
To invoke the S3 Object Lambda Access Point, run with your ARN: aws s3api get-object --bucket arn:aws:s3-object-lambda:us-east-1:123456789123:accesspoint/s3-object-lambda --key file.txt outfile.txt
Michael Wittig
I’ve been building on AWS since 2012 together with my brother Andreas. We are sharing our insights into all things AWS on cloudonaut and have written the book AWS in Action. Besides that, we’re currently working on bucketAV, attachmentAV, HyperEnv, and marbot.
Here are the contact options for feedback and questions.