eyantra's avatar

aws s3 access denied

I am uploading a folder on aws s3. Done a aws s3 configuration is correct and able to upload file successfully from localhost. But when i tried with same configuration from our ec2 server, getting Access denied error for PutObject.

0 likes
11 replies
eyantra's avatar

My localhost don't have ssl, but server have a ssl, can this create the issue with same configuration to upload ??

eyantra's avatar

[2020-10-07 08:09:24] local.ERROR: Error executing "PutObject" on "https://"; AWS HTTP error:$

AccessDeniedAccess Denied8E51B9 (truncated...) AccessDenied (client): Access Denied - AccessDeniedAccess Denied8E51B98B6AF999AA.......

AccessDeniedAccess Denied8E51B9 (truncated...) AccessDenied (client): Access Denied - AccessDeniedAccess Denied.......W/6RNMMKsSJsKd+46YMLjZ1zOJvSkC6Xy8HIRBlkbD4PLLdxKgdeBvR$ [stacktrace] #0 /var/www/eyrc20/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php(100): Aws\WrappedHttpHandler->parseError(Array, Object(GuzzleHttp\Psr7\Request), Object(Aws\C$ #1 /var/www/eyrc20/vendor/guzzlehttp/promises/src/Promise.php(203): Aws\WrappedHttpHandler->Aws\{closure}(Array)

[previous exception] [object] (GuzzleHttp\Exception\ClientException(code: 403): Client error: `PUT

AccessDeniedAccess Denied8E51B9 (truncated...) at /var/www/eyrc20/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:111) [stacktrace] #0 /var/www/eyrc20/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHt$ #1 /var/www/eyrc20/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))

eyantra's avatar

Storage::disk('s3')->put($s3path.$request->user()->team_id.'#'.$count.'_'.$filename, fopen($file, 'r+'));

Same code is working from localhost for uploading, but get error when deploy from ec2 server.

laracoft's avatar
laracoft
Best Answer
Level 27

@eyantra it sounds like your S3 credentials are wrong, have you checked .env?

eyantra's avatar

yes. Credentials are correct, because with same credentials and config i am able to upload the folder from my local machine. But when i using it from ec2 server, it's getting the access denied error.

eyantra's avatar

Resolved. It was name conflict issue in .env file with the BUCKET and QUEUE user.

Thank you for Help!! :)

Please or to participate in this conversation.