Upload Large Files To AWS S3 Bucket in Serverless application NodeJs

Muhammad Asad Attari
2 min readAug 24, 2022

--

AWS lambda do not allow payload size more than 10MB, if exceeds error will be thrown. Maximum payload limits exceeds.

So i’ll discuss the one solution to tackle this issue using signedUrl.

Step 1:

  • install aws-sdk using npm.

update the AWS configuration

Explanation:

  1. we take file extension as parameter of function,
  2. Expires defines the time for validity of signed URL.
  3. set the parameters for s3.getSignedUrlPromise function
  4. url will be returned by the above function,
  5. we can send PUT request to the returned url to upload image.

Note: contentType should be provided, otherwise you will get an error.

Step 2:

Test the returned URL to upload image.

you will get 200 success response.

Conclusion:

you have learned that how to upload large files using signedUrl. The URL valid for time you have provided, after that it will not work.

--

--

Muhammad Asad Attari
Muhammad Asad Attari

Written by Muhammad Asad Attari

Software Engineer | Full Stack Developer | DevOps Engr.

No responses yet