obtaining pre-signed request from heroku
<p>I'm looking at the heroku documentation (<a href="https://devcenter.heroku.com/articles/s3-upload-python" rel="nofollow">https://devcenter.heroku.com/articles/s3-upload-python</a>) about making a direct upload to S3 using a pre-signed request from heroku.  </p>

<p>For the code below, are you expected to send the actual file to Heroku to obtain the pre-signed request or can you just send the file info (name, type, etc.)?</p>

<pre><code>@app.route('/sign_s3/')
def sign_s3():
  S3_BUCKET = os.environ.get('S3_BUCKET')

  file_name = request.args.get('file_name')
  file_type = request.args.get('file_type')

  s3 = boto3.client('s3')

  presigned_post = s3.generate_presigned_post(
    Bucket = S3_BUCKET,
    Key = file_name,
    Fields = {"acl": "public-read", "Content-Type": file_type},
    Conditions = [
      {"acl": "public-read"},
      {"Content-Type": file_type}
    ],
    ExpiresIn = 3600
  )

  return json.dumps({
    'data': presigned_post,
    'url': 'https://%s.s3.amazonaws.com/%s' % (S3_BUCKET, file_name)
  })
</code></pre>

<p>The code you posted uses only the file name and type to generate an S3 pre-signed URL, so it's not using the file.</p>

<p>Once the server generates this S3 URL, it will send it to the client so it can use this URL to upload the file.</p>

<p>So the answer is no, your file is not sent to Heroku, just the file info. The file will be directly sent from the client side to S3.</p>

<p>More information on S3 pre-signed URLs can be found <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/PresignedUrlUploadObject.html" rel="nofollow">here</a></p>

python heroku amazon-s3