問題描述
我有一個 Codeigniter 網絡應用程序,它每小時向 Amazon S3 上傳許多小文件,這導致我的 S3 請求費用非???解決此問題的一種方法是壓縮文件,將 zip 文件上傳到 S3,然后在 S3 上解壓縮.
I have a Codeigniter web app that is uploading many tiny files every hour to Amazon S3, which is causing my S3 request charges to shoot up real fast. One way to overcome this will be to zip up the file, upload the zip file to S3, then unzip it when it is on S3.
這可以使用 EC2 完成嗎?或者有沒有更好的方法來實現這一目標?謝謝??!
Can this be done using EC2? Or is there a better method to achieve this? Thank you!!
如果我要使用 EC2,我是否使用 PHP 來觸發 EC2 實例的創建,上傳解壓縮壓縮文件所需的 PHP 文件,將解壓縮的文件復制到 S3,然后銷毀 EC2 實例?
If I were to use EC2, do I use PHP to trigger the creation of a EC2 instance, upload the PHP file required to unzip the zipped files, copy the uncompressed files to S3, then destroy the EC2 instance?
推薦答案
如果您在同一地區有一臺 EC2 機器,我建議您將它上傳到壓縮包中,然后從那里解壓到 s3.S3 無法自行解壓縮,因為它完全是靜態的.
If you have an EC2 machine in the same region I would suggest you upload it there zipped and then it drop it to s3 from there unzipped. S3 cannot unzip it on its own as its all static.
ec2 和 s3 之間沒有任何費用,因此 ec2 可以處理解壓縮,然后將其寫入您的 s3 存儲桶,而無需額外的傳輸費用.
Theres no charges between ec2 and s3 so ec2 can handle the unzipping and then write it out into your s3 bucket without additional transfer charges.
這篇關于上傳ZIP文件到S3,使用EC2解壓的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!