I’m using this script with PHP5-CLI to download a file from Amazon S3 to an EC2 instance, but it’s rather slow (1 minute for 160 MB, about 2 MB/s). Supposedly at least 10 MB/s should be possible. Am I doing something wrong in the code?
require 'aws-sdk/sdk.class.php';
$s3 = new AmazonS3(array(
'key' => '********',
'secret' => '******************'
));
$s3->get_object('mahbucket', 'filename.tar.gz', array('fileDownload' => 'downloaded.tar.gz'));
The bucket is in eu-west-1 and the instance in eu-west-1a
Your script looks fine, but I ran into similar issues a while ago, which I wasn’t abled to fix …
My new approach is using s3cmd for the file transfer between S3 buckets and my EC2 instances. You just have to configure it once and then you’re abled to trigger it via PHP. It’s also more secure because you don’t have to store your AWS credentials inside your script.
In my opinion the speed is okay:
Maybe this article is interesting as well: Network performance within Amazon EC2 and to Amazon S3