Upload file from React JS to AWS S3

  1. Prerequisite: i. Existing S3 bucket, ii. AWS access key ID and secret access key.
  2. Give project CORS permission on S3 bucket. Login to AWS console, go to your S3 bucket → Permission → CORS configuration. Paste the following CORSRule into CORSConfiguration and save.

4. For your react project, npm install aws-sdk.

5. Include this FileUpload component into your project, modify and use it.

Done.

Reference:

https://medium.com/@fabianopb/upload-files-with-node-and-react-to-aws-s3-in-3-steps-fdaa8581f2bd