简体   繁体   中英

How to zip file in .gz format in s3 bucket using java,aws-lamda

I am using AWS Toolkit plugin in eclipse to write the code and i am deploying it into aws lamda. I need to zip files in .gz format in s3 bucket of aws. Any suggestion to achieve this. Without using aws cli option.Thanks in advance.

All Lambda environments get 500MB of disk space. This is accessible in the /tmp directory. You can't just write to anywhere on the disk.

So in your example you'll need to do:

GZIPOutputStream gzos = new GZIPOutputStream(new FileOutputStream("/tmp/example.gz"));

If you really need it in a folder under /tmp then you'll first need to create the directory you could use something like:

Path outputPath = Files.createDirectories(Paths.get("/tmp/myfolder"));

to create the subdirectory under /tmp .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM