AWS package error in Laravel 4.2
Well, I am using Laravel version 4.2 in my application, but I have some problems with the AWS package: /
I am using this package https://github.com/aws/aws-sdk-php-laravel
I did everything that was described in the README.md but when I try to send the image to S3 I get this error
Failed to retrieve credentials from the instance profile metadata server. When you are not working inside Amazon EC2, you must provide your AWS Access ID and Private Access Key in "key" and "secret" options when creating a tenant, or provide an instance of the Aws \ Common \ Credentials \ CredentialsInterface object. ([curl] 7: Failed to connect to 169.254.169.254:80; No path to host [url] 169.254.169.254/latest/meta-data/iam/security-credentials/ )
I have put the package in my composer.json
"aws / aws-sdk-php-laravel": "1. *"
And send a command
Composer update
I put in app / config / packages / aws / aws-sdk-php-laravel / config.php folder
<?php
return array(
'key' => '[key]',
'secret' => '[secret]',
'region' => 'us-east-1',
'config_file' => null,
);
And try calling the method
AWS::get('s3')->putObject(array(
'Bucket' => ['bucket'],
'Key' => ['key'],
'SourceFile' => ['source']
));
But nothing works :(
Does anyone know what's going on?
source to share
I highly recommend using them for combo packages:
https://github.com/GrahamCampbell/Laravel-Flysystem/tree/v1.0.0 https://github.com/thephpleague/flysystem-aws-s3-v2
composer.json:
"graham-campbell/flysystem": "~1.0",
"league/flysystem-aws-s3-v2": "~1.0",
And in your code:
use GrahamCampbell\Flysystem\Facades\Flysystem;
// you can alias this in app/config/app.php if you like
Flysystem::put('hi.txt', 'foo');
// we're done here - how easy was that, it just works!
source to share