AWS API GW with POST request payload more than 10MB

0

The client-side needs to send a POST request with a payload exceeding 10MB, but the AWS API GW I'm working with has a strict 10MB limit(HTTP API quotas). Considering this constraint, is there any other way to work around this problem?

Jackson
asked 9 months ago1323 views
2 Answers
1

Hi Jackson,

Both Labmda and API payload size is hard limit and cannot be increased.

  1. If you want to upload file, you can consider using S3 pre-signed URL [1] , which allows client to directly upload or download object with payload greater than 10 MB. You can integrate API Gateway with Lambda function, such that lambda code will generate S3 pre-signed URL for API clients. API clients can use pre-signed URL to directly send and receive larger payload object. Here is a third-party documentation [2], with example implementation, as a reference.

  2. Alternatively, you can upload zipped file as the payload to the API gateway but that should be within the limit of 10 MB. However, kindly note that when a client sends a compressed payload along with a supported Content-Encoding header, API Gateway attempts to decompress the payload before forwarding it to the integration [3]. This is applicable even when ContentEncoding is not enabled at API Gateway. If the decompressed payload size is greater than 10MB it leads to a “413 Request Too Long” error from API Gateway.

[1] https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html

[2] https://sookocheff.com/post/api/uploading-large-payloads-through-api-gateway/

[3] https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-enable-compression.html#api-gateway-enable-compression-console

profile picture
answered 9 months ago
0

In such cases I have bookmarked this page with a few good patterns: https://aws.amazon.com/blogs/compute/patterns-for-building-an-api-to-upload-files-to-amazon-s3/

profile picture
EXPERT
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions