php - Use EC2 to Zip S3 files -


I am trying to use EC2 to zip some files stored in the S3 bucket. As far as I'm getting SWFUpload successfully working with PHP and uploading files to S3 I have read that the best way to zip S3 files without large transfer costs is to use EC2 to deal with S3. After a lot of efforts, I managed to get an EC2 server and SSH in running it, but now I do not know what to do from here.

What's the best way to zip S3 files and get them back in bucket?

Ideally, the user's batch upload will trigger an SQS and then I will spin the EC2 server once in a day and return them to S3 to download. Do not know where to go from here?

You should see a command-line tool for E-2, S3 and other AWS services. / P>

When you install the tool and set up your AWS credentials, it will create all types of commands - which includes S3.

The general idea is:

  • Download the file from the bucket ( s3get )
  • Zip it ( gzip & lt; file & gt; )
  • Upload it again ( s3put & lt; file & gt; )

Let me know that you need more pointers.

Maybe you want to zip it into PHP before uploading the file? Extension is required to install this.

  Install sudo pecl zip  

Here's an example script:

   open ($ filename, zipAye :: :: create!)! == true) {exit ("open to & lt; $ filename» gt; \ n "); } $ Zip- & gt; Adfile ('/ path / in / upload / file'); $ Zip- & gt; near (); Continue uploading to // s3  

Comments