uppy/examples/aws-nodejs
Merlijn Vos 7a50ab89ef
Cleanup examples (#5817)
- Remove outdated examples
- Rename folders for consistency
- Remove lots of unused deps in angular example.
- Rename `name` inside `package.json`'s from `@uppy-example/*` to
`example-*`.

**Before**

```
├── angular-example
├── aws-companion
├── aws-nodejs
├── aws-php
├── bundled
├── cdn-example
├── custom-provider
├── digitalocean-spaces
├── multiple-instances
├── node-xhr
├── php-xhr
├── python-xhr
├── react
├── react-native-expo
├── redux
├── sveltekit
├── transloadit
├── transloadit-markdown-bin
├── uppy-with-companion
├── vue3
└── xhr-bundle
```

**After**

```
examples
├── angular
├── aws-companion
├── aws-nodejs
├── aws-php
├── cdn
├── companion
├── companion-custom-provider
├── companion-digitalocean-spaces
├── react
├── react-native-expo
├── redux
├── sveltekit
├── transloadit
├── vue
├── xhr-bundle
├── xhr-node
├── xhr-php
└── xhr-python
```
2025-07-10 17:23:58 +02:00
..
public Release: uppy@3.27.1 (#5285) 2024-06-27 15:40:20 +00:00
index.js Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
package.json Cleanup examples (#5817) 2025-07-10 17:23:58 +02:00
README.md Release: uppy@4.0.0-beta.11 (#5243) 2024-06-13 11:22:50 +00: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.

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, tightening the security is out of the scope here.

S3 Setup

Assuming youre trying to setup the user MY-UPPY-USER to put the uploaded files to the bucket MY-UPPY-BUCKET, heres how you can allow MY-UPPY-USER to get STS Federated Token and upload files to MY-UPPY-BUCKET:

  1. Set CORS settings on MY-UPPY-BUCKET bucket:

    [
      {
        "AllowedHeaders": ["*"],
        "AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
        "AllowedOrigins": ["*"],
        "ExposeHeaders": ["ETag", "Location"]
      }
    ]
    
  2. Add the following Policy to MY-UPPY-BUCKET:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "MyMultipartPolicyStatement1",
          "Effect": "Allow",
          "Principal": {
            "AWS": "arn:aws:iam::*:user/MY-UPPY-USER"
          },
          "Action": [
            "s3:PutObject",
            "s3:PutObjectAcl",
            "s3:ListMultipartUploadParts",
            "s3:AbortMultipartUpload"
          ],
          "Resource": "arn:aws:s3:::MY-UPPY-BUCKET/*"
        }
      ]
    }
    
  3. Add the following Policy to MY-UPPY-USER: (if you dont want to enable signing on the client, you can skip this step)

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "MyStsPolicyStatement1",
          "Effect": "Allow",
          "Action": ["sts:GetFederationToken"],
          "Resource": ["arn:aws:sts::*:federated-user/*"]
        }
      ]
    }
    

AWS Credentials

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

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=MY-UPPY-BUCKET
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.

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