python - Getting boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden when uploading file -


There are some other questions on this issue:

validate = false setting. , and I believe that I have the correct key and secret key, because there are errors I tried to fake key or secret key). Here's my script:

  boto.s3.key import key BUCKET_NAME = imports from sys.argv Boto sys [1] AWS_ACCESS_KEY_ID = sys.argv [2] AWS_SECRET_ACCESS_KEY = sys.argv [3 ] Conn = boto.connect_s3 (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) bucket = conn.get_bucket (BUCKET_NAME, validate = false) k = key (bucket) k.key = 'barbaz' k.set_contents_from_filename ( '/ tmp / barbaz.txt') < / code> 

results:

  traceback (most recent call last): file "/ home / jonderry / sdmain / src / scripts / jenkins / upload_to_s3. Py ", line 16, & lt; Module & gt; k.set_contents_from_filename ( '/ tmp / barbaz.txt'), file "/usr/local/lib/python2.7/dist-packages/boto/s3/key.py", line 1360 in set_contents_from_filename encrypt_key = encrypt_key) file " in /usr/local/lib/python2.7/dist-packages/boto/s3/key.py ", line 1291, set_contents_from_file chunked_transfer = chunked_transfer, size = size) file" /usr/local/lib/python2.7/ Dist-packages / boto / s3 / key.py ", line 748, in send_file chunked_transfer = chunked_transfer, size = size) file" /usr/local/lib/python2.7/dist-packages/boto/s3/keypos ", Line 664, make_request retry_handler = retry_handler file in "/usr/local/lib/python2.7/dist-packages/boto/s3/connection.py", line 949, _send_file_internal query_args = query_args file "/ usr / local / lib /python2.7/dist-packages/boto/connection.py ", line 1 068, in make_request retry_handler = retry_handler) file "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 939, _mexe request.body, request.headers) file "/ usr / local / lib / pytho n2.7 / district-packages / Boto / S3 / key.py ", line 882, the response.status, response.reason, body) boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden & LT; XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Error & gt; & Lt; Code & gt; Accessed & lt; / Code & gt; & Lt; Message & gt; Access Denied & lt; / Messages & gt; & Lt; RequestId> *** someRequestId *** & lt; / RequestId> & Lt; Hostid & gt; *** someHostId & lt; / Hostid & gt; & Lt; / Error & gt;  

What is an idea problem, or how to further diagnose?

"itemprop =" text ">

It seems that you do not have the right to write on this bucket. What is bucket policy? Can you make sure that this IAM user can keep on this bucket?


Comments