mstdmstdd Posted November 9, 2017 Share Posted November 9, 2017 Hi all,In my laravel 5 application I have amazon s3 cloud usage, like: use Storage; ... $s3 = Storage::disk('s3'); $uploaded = $s3->put($upload_path, file_get_contents($this->file), 'public'); But but uploading my file I got errot : S3Exception in WrappedHttpHandler.php line 192: Error executing "PutObject" on "https://nsnmed.s3-us-west-2.amazonaws.com/uploads/OperationFile/24/1509953227-1.pdf"; AWS HTTP error: Client error: `PUT https://nsnmed.s3-us-west-2.amazonaws.com/uploads/OperationFile/24/1509953227-1.pdf` resulted in a `403 Forbidden` response: <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>F59F73 (truncated...) AccessDenied (client): Access Denied - <?xml version="1.0" encoding="UTF-8"?> <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>F59F7304DABAE9F7</RequestId><HostId>hFPo7S53x3DpmnndlKNe7hR5r1raq+qKn4asoNNVTOdGwS7KlQ0RmyVRE8LCYUOGedJjNRZuiOk=</HostId></Error> in WrappedHttpHandler.php line 192 at WrappedHttpHandler->parseError(array('exception' => object(ClientException), 'connection_error' => false, 'response' => object(Response)), object(Request), object(Command), array()) in WrappedHttpHandler.php line 97 at WrappedHttpHandler->Aws\{closure}(array('exception' => object(ClientException), 'connection_error' => false, 'response' => object(Response))) in Promise.php line 203 at Promise::callHandler('2', array('exception' => object(ClientException), 'connection_error' => false, 'response' => object(Response)), array(object(Promise), object(Closure), object(Closure))) in Promise.php line 174 at Promise::GuzzleHttp\Promise\{closure}(array('exception' => object(ClientException), 'connection_error' => false, 'response' => object(Response))) in RejectedPromise.php line 40 at RejectedPromise::GuzzleHttp\Promise\{closure}() in TaskQueue.php line 47 at TaskQueue->run() in CurlMultiHandler.php line 96 at CurlMultiHandler->tick() in CurlMultiHandler.php line 123 at CurlMultiHandler->execute(true) in Promise.php line 246 at Promise->invokeWaitFn() in Promise.php line 223 at Promise->waitIfPending() in Promise.php line 267 at Promise->invokeWaitList() in Promise.php line 225 at Promise->waitIfPending() in Promise.php line 267 at Promise->invokeWaitList() in Promise.php line 225 at Promise->waitIfPending() in Promise.php line 62 at Promise->wait() in S3ClientTrait.php line 33 at S3Client->upload('nsnmed', 'uploads/OperationFile/24/1509953227-1.pdf', '%PDF-1.3 %���� 194 0 obj << /Linearized 1 /L 1257876 /H [ 993 279 ] /O 197 /E 263192 /N 33 /T 1253877 >> endobj xref 194 11 0000000016 00000 n 0000000598 00000 n 0000000655 00000 n 0000001272 00000 n 0000001411 00000 n 0000001512 00000 n 0000001684 00000 n 00000017 I searched more and found this https://wogan.blog/2017/01/04/use-amazon-s3-with-laravel-5/ description and some other links. According to it I created bucket, IAM User, Group and Policy and attached my IAM User to the Group and Policy.Several printscreens from my aws s3 creditials:https://imgur.com/a/9UGO2http://i.piccy.info/i9/2ad57860552544212f6dac64203b861a/1509953635/50972/1194037/1.pnghttps://imgur.com/a/oZyWNhttps://imgur.com/a/bKq0YFull content of the policy : { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:ListAllMyBuckets", "s3:GetBucketLocation" ], "Resource": [ "arn:aws:s3:::nsnmed" ] }, { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject" ], "Resource": [ "arn:aws:s3:::nsnmed/*" ] } ] } and https://imgur.com/a/xafqHCould you please give me a hint which option did I miss ?P.S.Creating new user I checked "Programmatic access" option and left “AWS Management Console access” option uncheckedDescribing the Policy I wrote : "Resource": [ "arn:aws:s3:::nsnmed" ] }, Of my bucket.I did not find where to specify where user has permissions to access my bucket ? If there is such option ?Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.