title: Save an image from a HTTP request in S3 using python lambda
body: <p>I'm trying to create a simple serverless function in AWS with a Gateway API that allows uploading an image to the server, it should then save the image in a S3 bucket.
  This is my code:</p>
  <pre><code>def lambda_handler(event, context):
      operation = event['httpMethod']
      if operation != 'PUT':
          return respond(ValueError('Unsupported method &quot;{}&quot;'.format(operation)))
          
      try:
          queryParameters = event['queryStringParameters']
          
          username = queryParameters['username']
          picturename = username + &quot;_image&quot;
          print(&quot;picture name: &quot; + picturename)
          fileContent = event['body']
          print(&quot;body size: &quot; + str(len(fileContent)))
          object = s3.Object('zoneuserimagesbucket', picturename)
          object.put(Body=fileContent)
          return respond(None, &quot;OK&quot;)
          
  </code></pre>
  <p>The image being save is twice as big as the original and not the same as the original.. What I'm missing?</p>