[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ceph-community
Subject:    Re: [Ceph-community] InvalidObjectName Error when calling the PutObject operation
From:       Rishabh S <talktorishabh18 () gmail ! com>
Date:       2018-12-21 4:42:29
Message-ID: C9CD05CA-B5B8-4BA3-B9DE-6CA21F7AB881 () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Same example is given in boto3 examples doc.

From boto3/examples/s3.rst:

BUCKET = 'your-bucket-name'
    KEY = os.urandom(32)
    s3 = boto3.client('s3')

    print("Uploading S3 object with SSE-C")
    s3.put_object(Bucket=BUCKET,
                  Key='encrypt-key',
                  Body=b'foobar',
                  SSECustomerKey=KEY,
                  SSECustomerAlgorithm='AES256')
    print("Done")

Am I doing something wrong or missing anything?

Thanks & Regards,
Rishabh


> On 21-Dec-2018, at 9:52 AM, Rishabh S <talktorishabh18@gmail.com> wrote:
> 
> Dear Members,
> 
> I am trying to upload an object using SSE-Customer Provided Key and getting \
> following Error. 
> botocore.exceptions.ClientError: An error occurred (InvalidObjectName) when calling \
> the PutObject operation: Unknown 
> 
> > > > s3.list_buckets()
> {u'Owner': {u'DisplayName': 'User for deepscan testing', u'ID': 'deepscan'}, \
> u'Buckets': [{u'CreationDate': datetime.datetime(2018, 12, 3, 23, 31, 54, 205000, \
> tzinfo=tzutc()), u'Name': 'deepscan'}], 'ResponseMetadata': {'HTTPStatusCode': 200, \
> 'RetryAttempts': 0, 'HostId': '', 'RequestId': \
> 'tx000000000000000000019-005c1c6358-1035-default', 'HTTPHeaders': {'date': 'Fri, 21 \
> Dec 2018 03:51:52 GMT', 'content-length': '329', 'x-amz-request-id': \
> 'tx000000000000000000019-005c1c6358-1035-default', 'content-type': \
> 'application/xml'}}}
> > > > import os
> > > > KEY = os.urandom(32)
> > > > s3.put_object(Bucket='deepscan', Body=b'Just a long string piece of data', \
> > > > Key=KEY)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 320, in \
> _api_call return self._make_api_call(operation_name, kwargs)
> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 624, in \
> _make_api_call raise error_class(parsed_response, operation_name)
> botocore.exceptions.ClientError: An error occurred (InvalidObjectName) when calling \
> the PutObject operation: Unknown 
> Apart from above I also tried following put_object methods.
> 
> > > > s3.put_object(Bucket='deepscan', \
> > > > Key='encrypt-key',Body=b'foobar',SSECustomerKey=KEY,SSECustomerAlgorithm='AES256')
> > > > 
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 320, in \
> _api_call return self._make_api_call(operation_name, kwargs)
> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 624, in \
> _make_api_call raise error_class(parsed_response, operation_name)
> botocore.exceptions.ClientError: An error occurred (InvalidRequest) when calling \
> the PutObject operation: Unknown 
> > > > s3.put_object(Bucket='deepscan', Body='Just a long string piece of data', \
> > > > Key=KEY, Expires=datetime.datetime(2018, 12, 21), Metadata={'Mymeta1': '1', \
> > > > 'Mymeta2': '2'})
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 320, in \
> _api_call return self._make_api_call(operation_name, kwargs)
> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 624, in \
> _make_api_call raise error_class(parsed_response, operation_name)
> botocore.exceptions.ClientError: An error occurred (InvalidObjectName) when calling \
> the PutObject operation: Unknown 
> 
> > > > s3.put_object(Bucket='deepscan', Body='Just a long string piece of data', \
> > > > Key=KEY)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 320, in \
> _api_call return self._make_api_call(operation_name, kwargs)
> File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 624, in \
> _make_api_call raise error_class(parsed_response, operation_name)
> botocore.exceptions.ClientError: An error occurred (InvalidObjectName) when calling \
> the PutObject operation: Unknown 
> 
> I am referring to code example mentioned at:
> https://github.com/bloomberg/chef-bcs/blob/master/cookbooks/chef-bcs/files/default/s3-example-boto3.py \
> <https://github.com/bloomberg/chef-bcs/blob/master/cookbooks/chef-bcs/files/default/s3-example-boto3.py>
>  
> 
> Could someone please help what could be wrong and where to look for to further \
> investigate this issue. 
> 
> Regards,
> Rishabh


[Attachment #5 (unknown)]

<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
line-break: after-white-space;" class="">Same example is given in boto3 examples \
doc.<div class=""><br class=""></div><div class=""><b class="">From \
boto3/examples/s3.rst:</b></div><div class=""><br class=""></div><div class=""><div \
class="">BUCKET = 'your-bucket-name'</div><div class="">&nbsp; &nbsp; KEY = \
os.urandom(32)</div><div class="">&nbsp; &nbsp; s3 = boto3.client('s3')</div><div \
class=""><br class=""></div><div class="">&nbsp; &nbsp; print("Uploading S3 object \
with SSE-C")</div><div class="">&nbsp; &nbsp; s3.put_object(Bucket=BUCKET,</div><div \
class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
Key='encrypt-key',</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; Body=b'foobar',</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SSECustomerKey=KEY,</div><div class="">&nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
SSECustomerAlgorithm='AES256')</div><div class="">&nbsp; &nbsp; \
print("Done")</div><div class=""><br class=""></div><div class="">Am I doing \
something wrong or missing anything?</div><div class=""><br class=""></div><div \
class="">Thanks &amp; Regards,</div><div class="">Rishabh</div><div class=""><br \
class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On \
21-Dec-2018, at 9:52 AM, Rishabh S &lt;<a href="mailto:talktorishabh18@gmail.com" \
class="">talktorishabh18@gmail.com</a>&gt; wrote:</div><br \
class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" \
content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; \
-webkit-nbsp-mode: space; line-break: after-white-space;" class="">Dear Members,<br \
class=""><br class="">I am trying to upload an object using SSE-Customer Provided Key \
and getting following Error.<div class=""><br class=""></div><div \
class="">botocore.exceptions.ClientError: An error occurred (InvalidObjectName) when \
calling the PutObject operation: Unknown<br class=""><br class=""><div class=""><br \
class=""></div><div class="">&gt;&gt;&gt; s3.list_buckets()</div><div \
class="">{u'Owner': {u'DisplayName': 'User for deepscan testing', u'ID': 'deepscan'}, \
u'Buckets': [{u'CreationDate': datetime.datetime(2018, 12, 3, 23, 31, 54, 205000, \
tzinfo=tzutc()), u'Name': 'deepscan'}], 'ResponseMetadata': {'HTTPStatusCode': 200, \
'RetryAttempts': 0, 'HostId': '', 'RequestId': \
'tx000000000000000000019-005c1c6358-1035-default', 'HTTPHeaders': {'date': 'Fri, 21 \
Dec 2018 03:51:52 GMT', 'content-length': '329', 'x-amz-request-id': \
'tx000000000000000000019-005c1c6358-1035-default', 'content-type': \
'application/xml'}}}</div><div class="">&gt;&gt;&gt; import os</div><div \
class="">&gt;&gt;&gt; KEY = os.urandom(32)</div><div class="">&gt;&gt;&gt; \
s3.put_object(Bucket='deepscan', Body=b'Just a long string piece of data', \
Key=KEY)</div><div class="">Traceback (most recent call last):</div><div \
class="">&nbsp; File "&lt;stdin&gt;", line 1, in &lt;module&gt;</div><div \
class="">&nbsp; File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", \
line 320, in _api_call</div><div class="">&nbsp; &nbsp; return \
self._make_api_call(operation_name, kwargs)</div><div class="">&nbsp; File \
"/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 624, in \
_make_api_call</div><div class="">&nbsp; &nbsp; raise error_class(parsed_response, \
operation_name)</div><div class="">botocore.exceptions.ClientError: An error occurred \
(InvalidObjectName) when calling the PutObject operation: Unknown</div><div \
class=""><br class=""></div><div class="">Apart from above I also tried following \
put_object methods.</div><div class=""><br class=""></div><div class=""><div \
style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; \
color: rgb(62, 67, 73);" class=""><span style="-webkit-font-kerning: none;" \
class="">&gt;&gt;&gt; s3.put_object(Bucket='deepscan', \
Key='encrypt-key',Body=b'foobar',SSECustomerKey=KEY,SSECustomerAlgorithm='AES256')</span></div><div \
style="margin: 0px; font-stretch: normal; font-size: 14px; line-height: normal; \
color: rgb(62, 67, 73);" class=""><span style="-webkit-font-kerning: none;" \
class="">Traceback (most recent call last):</span></div><div style="margin: 0px; \
font-stretch: normal; font-size: 14px; line-height: normal; color: rgb(62, 67, 73);" \
class=""><span style="-webkit-font-kerning: none;" class="">&nbsp;&nbsp;File \
"&lt;stdin&gt;", line 1, in &lt;module&gt;</span></div><div style="margin: 0px; \
font-stretch: normal; font-size: 14px; line-height: normal; color: rgb(62, 67, 73);" \
class=""><span style="-webkit-font-kerning: none;" class="">&nbsp;&nbsp;File \
"/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 320, in \
_api_call</span></div><div style="margin: 0px; font-stretch: normal; font-size: 14px; \
line-height: normal; color: rgb(62, 67, 73);" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp; &nbsp;&nbsp;return \
self._make_api_call(operation_name, kwargs)</span></div><div style="margin: 0px; \
font-stretch: normal; font-size: 14px; line-height: normal; color: rgb(62, 67, 73);" \
class=""><span style="-webkit-font-kerning: none;" class="">&nbsp;&nbsp;File \
"/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 624, in \
_make_api_call</span></div><div style="margin: 0px; font-stretch: normal; font-size: \
14px; line-height: normal; color: rgb(62, 67, 73);" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp; &nbsp;&nbsp;raise \
error_class(parsed_response, operation_name)</span></div><div style="margin: 0px; \
font-stretch: normal; font-size: 14px; line-height: normal; color: rgb(62, 67, 73);" \
class=""><span style="-webkit-font-kerning: none;" \
class="">botocore.exceptions.ClientError: An error occurred (InvalidRequest) when \
calling the PutObject operation: Unknown</span></div></div><div style="margin: 0px; \
font-stretch: normal; font-size: 14px; line-height: normal; color: rgb(62, 67, 73);" \
class=""><span style="-webkit-font-kerning: none;" class=""><br \
class=""></span></div><div style="margin: 0px; font-stretch: normal; line-height: \
normal;" class=""><span style="-webkit-font-kerning: none;" class=""><div \
style="color: rgb(62, 67, 73); font-size: 14px; margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="-webkit-font-kerning: none;" \
class="">&gt;&gt;&gt; s3.put_object(Bucket='deepscan', Body='Just a long string piece \
of data', Key=KEY, Expires=datetime.datetime(2018, 12, 21), Metadata={'Mymeta1': '1', \
'Mymeta2': '2'})</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; \
margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">Traceback (most recent call \
last):</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp;&nbsp;File "&lt;stdin&gt;", line \
1, in &lt;module&gt;</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; \
margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp;&nbsp;File \
"/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 320, in \
_api_call</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; margin: \
0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp; &nbsp;&nbsp;return \
self._make_api_call(operation_name, kwargs)</span></div><div style="color: rgb(62, \
67, 73); font-size: 14px; margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="-webkit-font-kerning: none;" class="">&nbsp;&nbsp;File \
"/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 624, in \
_make_api_call</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; \
margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp; &nbsp;&nbsp;raise \
error_class(parsed_response, operation_name)</span></div><div style="color: rgb(62, \
67, 73); font-size: 14px; margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="-webkit-font-kerning: none;" \
class="">botocore.exceptions.ClientError: An error occurred (InvalidObjectName) when \
calling the PutObject operation: Unknown</span></div><div style="color: rgb(62, 67, \
73); font-size: 14px; margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="-webkit-font-kerning: none;" class=""><br \
class=""></span></div><div style="color: rgb(62, 67, 73); font-size: 14px; margin: \
0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class=""><br class=""></span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class=""><div style="color: rgb(62, 67, 73); \
font-size: 14px; margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="-webkit-font-kerning: none;" class="">&gt;&gt;&gt; \
s3.put_object(Bucket='deepscan', Body='Just a long string piece of data', \
Key=KEY)</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; margin: \
0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">Traceback (most recent call \
last):</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp;&nbsp;File "&lt;stdin&gt;", line \
1, in &lt;module&gt;</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; \
margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp;&nbsp;File \
"/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 320, in \
_api_call</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; margin: \
0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp; &nbsp;&nbsp;return \
self._make_api_call(operation_name, kwargs)</span></div><div style="color: rgb(62, \
67, 73); font-size: 14px; margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="-webkit-font-kerning: none;" class="">&nbsp;&nbsp;File \
"/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 624, in \
_make_api_call</span></div><div style="color: rgb(62, 67, 73); font-size: 14px; \
margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class="">&nbsp; &nbsp;&nbsp;raise \
error_class(parsed_response, operation_name)</span></div><div style="color: rgb(62, \
67, 73); font-size: 14px; margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="-webkit-font-kerning: none;" \
class="">botocore.exceptions.ClientError: An error occurred (InvalidObjectName) when \
calling the PutObject operation: Unknown</span></div><div style="color: rgb(62, 67, \
73); font-size: 14px; margin: 0px; font-stretch: normal; line-height: normal;" \
class=""><span style="-webkit-font-kerning: none;" class=""><br \
class=""></span></div><div style="color: rgb(62, 67, 73); font-size: 14px; margin: \
0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none;" class=""><br class=""></span></div><div \
style="color: rgb(62, 67, 73); font-size: 14px; margin: 0px; font-stretch: normal; \
line-height: normal;" class=""><span style="-webkit-font-kerning: none;" class="">I \
am referring to code example mentioned at:</span></div><div style="margin: 0px; \
font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none; caret-color: rgb(62, 67, 73); font-size: 14px;" \
class=""><font color="#3e4349" class=""><a \
href="https://github.com/bloomberg/chef-bcs/blob/master/cookbooks/chef-bcs/files/default/s3-example-boto3.py" \
class="">https://github.com/bloomberg/chef-bcs/blob/master/cookbooks/chef-bcs/files/default/s3-example-boto3.py</a></font></span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none; caret-color: rgb(62, 67, 73); font-size: 14px;" \
class=""><font color="#3e4349" class=""><br class=""></font></span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none; caret-color: rgb(62, 67, 73); font-size: 14px;" \
class=""><font color="#3e4349" class=""><br class=""></font></span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none; caret-color: rgb(62, 67, 73); font-size: 14px;" \
class=""><font color="#3e4349" class="">Could someone please help what could be wrong \
and where to look for to further investigate this issue.</font></span></div><div \
style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span \
style="-webkit-font-kerning: none; caret-color: rgb(62, 67, 73); font-size: 14px;" \
class=""><font color="#3e4349" class=""><br \
class=""></font></span></div></span></div></span></div><br class="">Regards,<br \
class="">Rishabh</div></div></div></blockquote></div><br \
class=""></div></body></html>



_______________________________________________
Ceph-community mailing list
Ceph-community@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-community-ceph.com


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic