title: How to upload in-memory zip file to S3-bucket
body: <p>I am trying to upload an in-memory zip file to an S3-bucket (in order to avoid temporary files on my server).</p>
  
  <p>Here's my code: </p>
  
  <pre><code>import zipfile
  import io
  zip_bytes_io = io.BytesIO()
  zip_archive = zipfile.ZipFile(zip_bytes_io, mode='a',
                                compression=zipfile.ZIP_DEFLATED)
  zip_archive.writestr('test.txt', b'My string')
  s3_client = boto3.client('s3')
  zip_bytes_io.seek(0)  # So that bytes are read from beginning
  s3_client.upload_fileobj(zip_bytes_io, test_bucket, 'test.zip')
  </code></pre>
  
  <p>When I run the above code, it does upload the file to an S3 bucket. However when I download the file, I am unable to unzip it. I get the error :"Error 1 - operation not permitted."</p>
  
  <p>I assume this is because I'm not uploading the file correctly in the first place. Any help appreciated :)</p>