I have followed this guide (https://laravel.com/docs/9.x/filesystem#amazon-s3-compatible-filesystems) and did the following.
I have tried several ways to integrate AWS s3, but it's not working:
- I have created an open to public S3 instance
- Added the CORS settings to it so that it could be accessed from my localhost machine: http://127.0.0.1:8000/
[
{
"AllowedHeaders": [
""
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"http://127.0.0.1:8000/"
],
"ExposeHeaders": [
"x-amz-server-side-encryption",
"x-amz-request-id",
"x-amz-id-2"
],
"MaxAgeSeconds": 3000
}
]
- Updated Block public access and deselected all Added bucket policy to:
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": ""
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::NAME_OF_MY_BUCKET/*"
}
]
}
- Updated filesystem config:
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'visibility' => 'public'
],
- Required
"league/flysystem-aws-s3-v3": "^3.3"viacomposer - But when I add the field into one of my modal
Image::make('Media', 'image')
->disk('s3'),
It never uploads anything on my AWS bucket neither it displays any images
storage/logsand see if you have any recent Laravel errors