7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS APIGateWayのペイロードサイズは最大10MB(S3へのファイルアップロードは別の方法で)

Last updated at Posted at 2019-05-16

きっかけ

APIGateWayでS3へのファイルアップロードを行う、LambdafunctionのRestAPIを作成していた

問題発生

動作確認、調査をしようとしていたところ
APIGateWayのペイロードサイズは最大10MBである事が判明
https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/limits.html

回避策

下記のページにて回避策を発見
https://sookocheff.com/post/api/uploading-large-payloads-through-api-gateway/

AWS-SDKを使用すればS3への一時的なアップロードURLを生成できるので
それを使用してアップロードを行う。

具体的な対応

下記の動作仕様を下記の様にする

  1. アップロードするファイルを格納する(クライアント)
  2. アップロードボタンをクリックする(クライアント)
  3. Rest-APIにてS3への一時的なアップロードURLを生成する(サーバサイド)
  4. S3への一時的なアップロードURLを受け取る(クライアント)
  5. 生成されたURLでファイルをアップロードする(クライアント)
7
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?