Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS S3 cURL timed out

In general, AWS S3 works fine in my web. However, I keep getting randomly these errors when downloading:

Error retrieving credentials from the instance profile metadata server. (cURL error 28: Operation timed out after {>1000} milliseconds with 0 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html))

Why? How can I prevent these errors from happening?

I am using AWS SDK PHP v3.

like image 613
Medical physicist Avatar asked Dec 05 '25 10:12

Medical physicist


1 Answers

if are you using a Credential like below

$s3 = new Aws\S3\S3Client([
        'version' => 'latest',
        'region'  => 'us-east-1',
        'key' => "AKIAJAAAXXYASASASASDSUAG66MA",
        'secret'  => "8sZyAAAAXUSuUK3FJSDFSDS&D*SDSJFSFShjssa7Fx+GS9"
    )
]);

then change to like this

   $s3 = new Aws\S3\S3Client([
        'version' => 'latest',
        'region'  => 'us-east-1',
        'credentials' => array(
            'key' => "AKIAJAAAXXYASASASASDSUAG66MA",
            'secret'  => "8sZyAAAAXUSuUK3FJSDFSDS&D*SDSJFSFShjssa7Fx+GS9"
        )
    ]);
like image 129
Nilesh patel Avatar answered Dec 07 '25 22:12

Nilesh patel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!