Upload Large Files To AWS S3 Bucket in Serverless application NodeJs
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:
- we take file extension as parameter of function,
- Expires defines the time for validity of signed URL.
- set the parameters for s3.getSignedUrlPromise function
- url will be returned by the above function,
- 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.