uppy/examples/aws-nodejs
github-actions[bot] eafe30020e
Release: uppy@3.3.1 (#4222)
| Package                | Version | Package                | Version |
| ---------------------- | ------- | ---------------------- | ------- |
| @uppy/angular          |   0.5.1 | @uppy/companion-client |   3.1.1 |
| @uppy/aws-s3-multipart |   3.1.1 | @uppy/utils            |   5.1.1 |
| @uppy/companion        |   4.1.1 | uppy                   |   3.3.1 |

- @uppy/aws-s3-multipart: handle slow connections better (Antoine du Hamel / #4213)
- @uppy/companion-client: treat `*` the same as missing header (Antoine du Hamel / #4221)
- @uppy/utils: fix types (Antoine du Hamel / #4212)
- @uppy/companion: send expire info for non-multipart uploads (Antoine du Hamel / #4214)
- docs: fix `allowedMetaFields` documentation (Antoine du Hamel / #4216)
- meta: add more bundlers for automated testing (Antoine du Hamel / #4100)
- @uppy/aws-s3-multipart: Fix typo in url check (Christian Franke / #4211)
- meta: use current version of packages when testing bundlers (Antoine du Hamel / #4208)
- meta: do not use the set-output command in workflows (Antoine du Hamel / #4175)
2022-11-16 14:19:54 +00:00
..
public Release: uppy@3.3.1 (#4222) 2022-11-16 14:19:54 +00:00
index.js Add example for Uppy with S3 and a Node.js server (#4129) 2022-10-17 16:43:00 -03:00
package.json examples: mark @uppy-example/aws-nodejs as private 2022-10-19 22:13:07 +02:00
README.md Add example for Uppy with S3 and a Node.js server (#4129) 2022-10-17 16:43:00 -03:00

Uppy + AWS S3 with Node.JS

A simple and fully working example of Uppy and AWS S3 storage with Node.js (and Express.js) It uses presigned URL at the backend level.

This README file starts with AWS as this one need to be resolved first.

AWS Configuration

It's assumed that you are familiar with AWS, at least, with the storage service (S3) and users & policies (IAM).

These instructions are not fit for production but tightening the security is out of the scope here.

S3 Setup

  • Create new S3 bucket in AWS (e.g. aws-nodejs).
  • Add a bucket policy.
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicAccess",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::aws-nodejs/*"
        }
    ]
}
  • Make the S3 bucket public.
  • Add CORS configuration.
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET",
            "PUT",
            "HEAD",
            "POST",
            "DELETE"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
]

AWS Credentials

You may use existing AWS credentials or create a new user in the IAM page.

    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": "arn:aws:s3:::aws-nodejs/*"
        }
    ]
}

Install

Download this code or clone repository into a folder and install dependencies:

corepack yarn install

Add a .env file to the root directory and define the S3 bucket name and port variables like the example below:

S3_BUCKET=aws-nodejs
PORT=8080

Enjoy it

Start the application:

corepack yarn workspace @uppy-example/aws-nodejs start

Dashboard demo should now be available at http://localhost:8080.

You have also a Drag & Drop demo on http://localhost:8080/drag.

Feel free to check how the demo works and feel free to open an issue.