Unzip ZIP file on Amazon S3
Asked Answered
H

3

8

I'm uploading ZIP file to Amazon S3. Now I need to unzip that file on S3. Is there any commands that S3 has to unzip it there. I'm using JAVA to upload files to S3.

Higbee answered 28/11, 2011 at 23:14 Comment(0)
C
8

Infact, I am doing the same thing. You upload the zip onto S3. Write a small java batch program that will scan your folder for the zip on S3, download it, unzip it and then upload the data back to S3 again. If you do this on a EC2 instance on the same region as your bucket, then since the latency is very low, that should happen very fast.

Commons answered 29/11, 2011 at 1:22 Comment(0)
Y
5

S3 does not parse the contents of your files. It does not know how to unzip them. If you need to upload each file in the zip you should unzip it yourself and upload each one separately. This website about java.util.zip should get you started.

Yumuk answered 28/11, 2011 at 23:20 Comment(0)
T
1

I faced a similar problem and have solved it by utilising Java AWS sdk. To make it suitable for larger files the key is to "stream" the content, without keeping any data in memory or writing to disk.

I've made a library that can be used for this purpose and is available in Maven Central, here is the GitHub link: nejckorasa/s3-stream-unzip

Typescript answered 7/10, 2022 at 12:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.