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
已提問 4 個月前檢視次數 446 次
2 個答案
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
已回答 4 個月前
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
專家
已回答 4 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南