I’m generating large text files that can have up to ~50 MB. Zipping them cuts the size by half, 50 MB becomes ~25 MB. Instead of uploading text files I would like to upload a zip and let S3 unzip it. Does S3 support such thing (auto unzip)?
Question posted in Amazon Web Sevices
The official Amazon Web Services documentation can be found here.
The official Amazon Web Services documentation can be found here.
3
Answers
S3 can’t automatically unzip a file, but you can use S3 Event Notifications to invoke a Lambda that unzip the file (and then delete the zipped archive, if you want).
You can configure an S3 Event Lambda on your bucket and then use this solution to automatically unzip files.
You can create a Lambda function that implements RequestHandler<S3Event, String> interface.
This gives you access to the S3 object and bucket where an update occurred. Then you can get the ZIP file and pass it to a method that can unzipped the file and get the files.
For example, if I were to write the Lambda handler using the Java run-time API:
Make sure that you configure this Lambda function as an S3 Trigger in the AWS Lambda Console. Once you set the trigger up, you will see it in the AWS Management Console as shown here: