| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/aws-s3 | 3.2.1 | @uppy/golden-retriever | 3.1.0 | | @uppy/aws-s3-multipart | 3.4.1 | @uppy/status-bar | 3.2.1 | | @uppy/companion | 4.6.0 | @uppy/tus | 3.1.2 | | @uppy/companion-client | 3.2.0 | @uppy/xhr-upload | 3.3.1 | | @uppy/core | 3.3.0 | uppy | 3.11.0 | - @uppy/companion: fix infinite recursion in uploader test (Mikael Finstad / #4536) - @uppy/xhr-upload: export `Headers` type (Masum ULU / #4549) - @uppy/aws-s3-multipart: increase priority of abort and complete (Stefan Schonert / #4542) - @uppy/aws-s3: fix remote uploads (Antoine du Hamel / #4546) - meta: use `corepack yarn` instead of `npm` to launch E2E (Antoine du Hamel / #4545) - @uppy/aws-s3-multipart: fix upload retry using an outdated ID (Antoine du Hamel / #4544) - @uppy/status-bar: remove throttled component (Artur Paikin / #4396) - @uppy/aws-s3-multipart: fix Golden Retriever integration (Antoine du Hamel / #4526) - examples/aws-nodejs: merge multipart and non-multipart examples (Antoine du Hamel / #4521) - @uppy/companion: bump semver from 7.3.7 to 7.5.3 (dependabot[bot] / #4529) - @uppy/aws-s3-multipart: add types to internal fields (Antoine du Hamel / #4535) - examples/aws-nodejs: update README (Antoine du Hamel / #4534) - examples/aws-nodejs: showcase an example without preflight requests (Antoine du Hamel / #4516) - @uppy/aws-s3-multipart: fix pause/resume (Antoine du Hamel / #4523) - @uppy/status-bar: fix ETA when Uppy recovers its state (Antoine du Hamel / #4525) - @uppy/aws-s3-multipart: fix resume single-chunk multipart uploads (Antoine du Hamel / #4528) - @uppy/companion: fix part listing in s3 (Antoine du Hamel / #4524) - example/aws-php: make it forward-compatible with the next Uppy major (Antoine du Hamel / #4522) - @uppy/golden-retriever: refactor to modernize the codebase (Antoine du Hamel / #4520) - examples/aws-nodejs: upgrade to AWS-SDK v3 (Antoine du Hamel / #4515) - @uppy/companion: implement refresh for authentication tokens (Mikael Finstad / #4448) - @uppy/aws-s3-multipart: disable pause/resume for remote uploads in the UI (Artur Paikin / #4500) - @uppy/tus: retry on 423 HTTP error code (Antoine du Hamel / #4512) |
||
|---|---|---|
| .. | ||
| public | ||
| index.js | ||
| package.json | ||
| README.md | ||
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.
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.
- Make sure you setup the AWS credentials properly and write down the Access Key ID and Secret Access Key.
- You may configure AWS S3 credentials using
environment variables
or a
credentials file in
~/.aws/credentials. - You will need at least
PutObjectandPutObjectAclpermissions.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": ["s3:PutObject", "s3:PutObjectAcl"],
"Resource": "arn:aws:s3:::aws-nodejs/*"
}
]
}
Prerequisites
Download this code or clone repository into a folder and install dependencies:
CYPRESS_INSTALL_BINARY=0 corepack yarn install
Add a .env file to the root directory and define the S3 bucket name and port
variables like the example below:
COMPANION_AWS_BUCKET=aws-nodejs
COMPANION_AWS_REGION=…
COMPANION_AWS_KEY=…
COMPANION_AWS_SECRET=…
PORT=8080
N.B.: This example uses COMPANION_AWS_ environnement variables to facilitate
integrations with other examples in this repository, but this example does not
uses Companion at all.
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.