I intend to use AWS API Gateway & Lambda to perform a file upload to S3, via POST from a HTML form. However, the API Gateway endpoint will fail if the file is big enough, with message [HTTP content length exceeded 10485760 bytes.].
Do you happen to know any way to increase this limit?
It is the same irrespective if the API method hides a Lambda function or is simply a mock method.
There is currently no way to increase this limit.
Additionally, API Gateway is not currently optimized to support binary transfer to S3. This is a request we have heard from other customers and we may add support for this in the future.
Update 2017-02-19: While there is still no way to increase payload size limits, API Gateway does now support binary data.
You can use the multi-part upload functions available as part of the S3 API.
https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html
You would have to add three endpoints to start the process, upload a chunk, and complete the process. Also consider adding an abort routine.
Client side, you would need to chunk the file into segments, and then upload them asynchronously.
This gets each post under API Gateway's 10MB limit. Obviously, you can't do that with a standard html form and would need some javascript handling to chunk the file and handle the asynchronous request.
Alternatively, you could bypass the gateway and post directly to the S3 Rest API. However, you lose the benefits of the gateway and introduce some security risks.
https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With