I am developing a web application using Laravel. In my application, I develop a feature for uploading the file to the server. But, I will store the files in the Amazon S3 bucket instead. So, I am just following the Laravel official documentation - https://laravel.com/docs/5.5/filesystem. But I am getting an error. Please see what I have done below.
First I run this command to install required package in the terminal
composer require league/flysystem-aws-s3-v3
Then in the environment file, I added these variable
AWS_IAM_KEY=xxxxxxx
AWS_IAM_SECRET=xvxxxx
AWS_REGION=eu-west-2
AWS_BUCKET=xxxxxxx
Then in the controller, I upload like this.
$request->file('photo_file')->store(
'activity_files/'.uniqid(), 's3'
);
When I upload the file, it is giving me this error.
Error retrieving credentials from the instance profile metadata server. (cURL error 7: Failed to connect to 169.254.169.254 port 80: Network unreachable (see http://curl.haxx.se/libcurl/c/libcurl-errors.html))
What is wrong with my code?