Q: Running java operation directly on AWS S3 target bucket We have the following workflow at my work:
Download the data from AWS s3 bucket to the workspace:
aws s3 cp --only-show-errors s3://bucket1

Unzip the data
unzip -q "/workspace/folder1/data.zip" -d "/workspace/folder2"

Run a java command
java -Xmx1024m -jar param1 etc...

Sync the archive back to the s3 target bucket
aws s3 sync --include #{archive.location} s3://bucket

As you can see that the downloading data from s3 bucket, unzipping, running some java operation on the data and copying back to s3 costs a lot of time and resources.
Hence, we are planning to unzip directly in the s3 target bucket and run java operation there. Would it be  possible to run the java operation directly in s3 bucket? If yes, could you please provide some insights?  

A: Its not possible to run the java 'in S3', but what you can do is move your Java code to an AWS Lambda function, and all the work can be done 'in the cloud', i.e., no  need to download to a local machine, process and re-upload.
Without knowing the details of you requirements, I would consider setting up an S3 notification request that gets invoked each time a new file gets PUT into a particular location, and AWS Lambda function that gets invoked with the details of that new file, and then have Lambda output the results to a different bucket/location with the results.
I have done similar things (though not with java) and have found it rock solid way of processing files.

A: No.
You cannot run code on S3.

A: S3 is an object store, which don't provide any executing environment. To do any modifications to the files, you need to download it, modify and upload back to S3.
If you need to do operations on files, you can look into using AWS Elastic File System which you can mount to your EC2 instance and do the operations as required.
