I am using Symfony to upload a file to an amazon bucket. First off I can successfully upload this file to my Amazon bucket using the CLI but when I attempt to do it via Symfony I get this error:
"Error retrieving credentials from the instance profile metadata server. (cURL error 28: Timeout was reached)"
I am using the EXACT same credentials that I am using in the CLI, yet in Symfony, yet I just get errors…
Here’s my code…
$s3 = new S3Client([ 'key'=>'XXXXXXXXXXXX', 'secret'=>'XXXXXXXXXXXX', 'region'=>'us-east-2', 'version'=>'latest', ]); $cmd = $s3->getCommand('PutObject', [ 'Bucket' => 'my-bucket-name', 'Key' => 'file-name.png', 'SourceFile' => '/source/file-name.png', 'ContentType' => 'image/png', 'ACL' => 'public-read', 'StorageClass' => 'REDUCED_REDUNDANCY' ]); $result = $s3->execute($cmd);
What am I doing wrong? Thanks.