uploading an image file to aws s3 using python
<pre><code>import tinys3

 conn =tinys3.Connection(aws_key_id,aws_secrert_key)

 f = open('c:/Users/Akhil/Downloads/New/img033.jpg','rb')
 conn.upload('c:/Users/Akhil/Downloads/New/img033.jpg',f,'matt3r')
</code></pre>

<p>I am trying to upload an image present in local directory shown below to aws s3 matt3r bucket. when I run this I am getting the following error :</p>

<pre><code>Traceback (most recent call last):
File "conn.py", line 6, in &lt;module&gt;
conn.upload('c:/Users/Akhil/Downloads/New/img033.jpg',f,'matt3r')
File "C:\Python27\lib\site-packages\tinys3\connection.py", line 171, in    upload
 return self.run(r)
File "C:\Python27\lib\site-packages\tinys3\connection.py", line 262, in run
return self._handle_request(request)
File "C:\Python27\lib\site-packages\tinys3\connection.py", line 356, in _handle_request
return request.run()
File "C:\Python27\lib\site-packages\tinys3\request_factory.py", line 346, in run
auth=self.auth)
File "C:\Python27\lib\site-packages\requests\api.py", line 123, in put
return request('put', url, data=data, **kwargs)
File "C:\Python27\lib\site-packages\requests\api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python27\lib\site-packages\requests\sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "C:\Python27\lib\site-packages\requests\adapters.py", line 473, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(10054,   'An existing connection was forcibly closed by the remote host'))
</code></pre>

<p>You need to add policy for AWS S3 to your IAM user. </p>

python amazon-web-services amazon-s3