title: upload video to aws S3
body: <p>I am trying to upload a video to an S3 bucket using the API interface, I followed the presigned URL procedure, here is my lambda function that returns the presigned URL (it returns the presigned url correctly - seemingly):</p>
  <pre><code>import json
  import base64
  import boto3
  import uuid
  BUCKET_NAME = 'redacted-bucket-instance'
  
  def lambda_handler(event, context):
      actionId = uuid.uuid4()
      file_path = &quot;video_uploads/&quot; + str(actionId) + &quot;.mp4&quot;
      s3 = boto3.client('s3')
      s3Params = {
          &quot;Bucket&quot;: BUCKET_NAME,
          &quot;Key&quot;: file_path,
          &quot;ContentType&quot;: 'video/mp4',
          &quot;ACL&quot;: 'public-read'
      }
      try:
          s3_response = s3.generate_presigned_url('put_object', Params=s3Params, ExpiresIn=3600, HttpMethod=&quot;PUT&quot;)
      except Exception as e:
          raise IOError(e)
      return {
          'statusCode': 200,
          'body': {
              'file_path': file_path,
              'url': s3_response
          }
      }
  </code></pre>
  <p>when I try to upload an mp4 video with curl like this for ex:
  curl -X PUT -F 'data=@ch01_00000100055009702.mp4' <a href="https://redacted-bucket-instance.s3.amazonaws.com//video_uploads/a845a97f-a218-4815-a836-376e498a4334.mp4?AWSAccessKeyId=ASIAWZPXMJR5V7GEHUJJ&amp;Signature=zDsdfsdfqsdfD&amp;content-type=video%2Fmp4&amp;x-amz-acl=public-read&amp;etc" rel="nofollow noreferrer">https://redacted-bucket-instance.s3.amazonaws.com//video_uploads/a845a97f-a218-4815-a836-376e498a4334.mp4?AWSAccessKeyId=ASIAWZPXMJR5V7GEHUJJ&amp;Signature=zDsdfsdfqsdfD&amp;content-type=video%2Fmp4&amp;x-amz-acl=public-read&amp;etc</a></p>
  <p>or</p>
  <p>curl -X PUT --data-binary '@ch01_00000100055009702.mp4' <a href="https://redacted-bucket-instance.s3.amazonaws.com//video_uploads/a845a97f-a218-4815-a836-376e498a4334.mp4?AWSAccessKeyId=ASIAWZPXMJR5V7GEHUJJ&amp;Signature=zDsdfsdfqsdfD&amp;content-type=video%2Fmp4&amp;x-amz-acl=public-read&amp;etc" rel="nofollow noreferrer">https://redacted-bucket-instance.s3.amazonaws.com//video_uploads/a845a97f-a218-4815-a836-376e498a4334.mp4?AWSAccessKeyId=ASIAWZPXMJR5V7GEHUJJ&amp;Signature=zDsdfsdfqsdfD&amp;content-type=video%2Fmp4&amp;x-amz-acl=public-read&amp;etc</a></p>
  <p>in both cases, the terminal closes...whatcould I be doing wrong here?</p>
  <p>(both url are not the ones received of course but just there for demonstration)</p>
  <p><em>Edit</em></p>
  <p>Adding quotes for the url prevented the terminal from closing and gave a reponse.(I'm guessing some characters needed to be escaped)</p>
  <p>Now I'm getting this error:</p>
  <pre><code>&lt;Error&gt;&lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt;&lt;Message&gt;The request signature we calculated does not match the signature you provided. Check your key and signing method.&lt;/Message&gt;&lt;AWSAccessKeyId&gt;ASIAWZPXMJR54PMEJVPQ&lt;/AWSAccessKeyId&gt;
  </code></pre>
  <p>Should I add headers in the request for it to work?</p>
  <p>(I renewed the presigned url to make sure it's valid during teseting)</p>