AWS php sdk for on the fly writing to s3bucket

207 Views Asked by At

I want to write some files(videos) in s3 bucket1 to s3bucket2 as zip on the fly without using any disk space for temporary storage. It should happen with a minimum span of time with less overhead. Currently I am using zipstream for making zip but it is not possible to write on the fly to bucket. Any help is appeciated.

1

There are 1 best solutions below

1
Sergey Kovalev On

Yes, you can. If you have your object in memory as a string, just use file_put_contents.

file_put_contents('s3://bucket/key', $your_data);

This is totally legit since PHP SDK support supports stream wrappers: http://docs.aws.amazon.com/aws-sdk-php/v2/guide/feature-s3-stream-wrapper.html