0

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:

  1. I have created an open to public S3 instance
  2. 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
    }
]
  1. 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/*"
        }
    ]
}
  1. 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'
],
  1. Required "league/flysystem-aws-s3-v3": "^3.3" via composer
  2. 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

3
  • please show your code for uploading. Is the Image for Intervention package? Commented Sep 15, 2022 at 18:16
  • @parastoo I use Nova 4 "Image::make('Media', 'image')->disk('s3')," is the code which handles everything including upload and display Commented Sep 15, 2022 at 18:24
  • @Lonare you must have an error somewhere, check your chrom console and see if you have any errors there, also check your storage/logs and see if you have any recent Laravel errors Commented Sep 16, 2022 at 1:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.