{"id":11153496,"date":"2019-01-31T14:04:56","date_gmt":"2019-01-31T14:04:56","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/error-executing-putobject\/"},"modified":"2019-01-31T14:04:56","modified_gmt":"2019-01-31T14:04:56","slug":"error-executing-putobject","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/error-executing-putobject\/","title":{"rendered":"Error executing &#8220;PutObject&#8221;"},"content":{"rendered":"<p>Hi.<\/p>\n<p>We configured a bucket on S3, but it seems that there are problems with IAM policy. During file upload we got a 403 Forbidden error:<\/p>\n<blockquote><p>[Thu Jan 31 14:52:34.907763 2019] [php7:notice] [pid 25470] [client 172.31.10.217:46672] AS3CF: Error offloading \/data\/www\/wp-content\/uploads\/2019\/01\/Network-Automation.pdf to provider: Error executing &#8220;PutObject&#8221; on &#8220;https:\/\/tobedeleted-test.s3.eu-west-1.amazonaws.com\/wp-content\/uploads\/2019\/01\/31145234\/Network-Automation.pdf&#8221;; AWS HTTP error: Client error: <code>PUT https:\/\/tobedeleted-test.s3.eu-west-1.amazonaws.com\/wp-content\/uploads\/2019\/01\/31145234\/Network-Automation.pdf<\/code> resulted in a <code>403 Forbidden<\/code> response:\\n&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;\\n&lt;Error&gt;<Code>AccessDenied<\/Code>&lt;Message&gt;Access Denied&lt;\/Message&gt;&lt;RequestId&gt;671DE7 (truncated&#8230;)\\n AccessDenied (client): Access Denied &#8211; &lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;\\n&lt;Error&gt;<Code>AccessDenied<\/Code>&lt;Message&gt;Access Denied&lt;\/Message&gt;&lt;RequestId&gt;671DE7A2CB1F6C19&lt;\/RequestId&gt;&lt;HostId&gt;H8blhGvGKTJQ5AxCfWQBaAvitxhyiaqFmh4YA7CPEO1s1vyWBFw7XWUH1xBmddrbbs+rEOnV5Es=&lt;\/HostId&gt;&lt;\/Error&gt;<\/p><\/blockquote>\n<p>These are the policy assigned to the bucket:<\/p>\n<blockquote><p>{<br \/>\n    &#8220;Version&#8221;: &#8220;2012-10-17&#8221;,<br \/>\n    &#8220;Statement&#8221;: [<br \/>\n        {<br \/>\n            &#8220;Action&#8221;: [<br \/>\n                &#8220;s3:GetBucketLocation&#8221;,<br \/>\n                &#8220;s3:ListAllMyBuckets&#8221;<br \/>\n            ],<br \/>\n            &#8220;Resource&#8221;: &#8220;arn:aws:s3:::*&#8221;,<br \/>\n            &#8220;Effect&#8221;: &#8220;Allow&#8221;<br \/>\n        },<br \/>\n        {<br \/>\n            &#8220;Action&#8221;: [<br \/>\n                &#8220;s3:ListBucket&#8221;<br \/>\n            ],<br \/>\n            &#8220;Resource&#8221;: [<br \/>\n                &#8220;arn:aws:s3:::tobedeleted-test&#8221;<br \/>\n            ],<br \/>\n            &#8220;Effect&#8221;: &#8220;Allow&#8221;<br \/>\n        },<br \/>\n        {<br \/>\n            &#8220;Action&#8221;: [<br \/>\n                &#8220;s3:List*&#8221;,<br \/>\n                &#8220;s3:Put*&#8221;,<br \/>\n                &#8220;s3:Get*&#8221;,<br \/>\n                &#8220;s3:AbortMultipartUpload&#8221;,<br \/>\n                &#8220;s3:DeleteObject*&#8221;<br \/>\n            ],<br \/>\n            &#8220;Resource&#8221;: [<br \/>\n                &#8220;arn:aws:s3:::tobedeleted-test&#8221;,<br \/>\n                &#8220;arn:aws:s3:::tobedeleted-test\/*&#8221;<br \/>\n            ],<br \/>\n            &#8220;Effect&#8221;: &#8220;Allow&#8221;<br \/>\n        }<br \/>\n    ]<br \/>\n}<\/p><\/blockquote>\n<p>I tried using the AWS cli with the same IAM user credentials, and I was able to upload files. After configuring the bucket on backend, I see an error message on top of configurations page:<\/p>\n<p>&#8220;Access Denied to Bucket\t\u2014 Looks like we don&#8217;t have write access to this bucket. It&#8217;s likely that the user you&#8217;ve provided access keys for hasn&#8217;t been granted the correct permissions. Please see our Quick Start Guide for instructions on setting up permissions correctly.&#8221;<\/p>\n<p>Is there something wrong with the policy? Should I enable other actions?<\/p>\n<p>Thanks.<\/p>\n","protected":false},"template":"","class_list":["post-11153496","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11153496","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11153496\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11153496"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}