ServicesAWS S3

AWS S3

Installation

Install S3 service

npm i @uplo/service-s3

Add service to Uplo

import S3Service from '@uplo/service-s3'
 
const uplo = Uplo({
  services: {
    s3: S3Service({
      isPublic: false,
      region: process.env.AWS_REGION,
      bucket: process.env.AWS_BUCKET,
      accessKeyId: '*****',
      secretAccessKey: '*****',
    }),
  },
})

Options

  • bucket (required): Your bucket name where to store objects.
  • accessKeyId (required): Provide Access Key ID from your service credentials
  • secretAccessKey (required): Provide Secret Access Key from your service credentials
  • region = 'us-east-1: Provide your service region
  • isPublic = false: Specify a bucket ACL
  • endpoint: You can provide a custom endpoint if you have a custom service

Direct Upload

CORS

This is example CORS configuration for direct uploads.

[
  {
    "AllowedHeaders": [
      "*"
    ],
    "AllowedMethods": [
      "PUT"
    ],
    "AllowedOrigins": [
      "https://www.example.com"
    ],
    "ExposeHeaders": [
      "Origin",
      "Content-Type",
      "Content-MD5",
      "Content-Disposition"
    ],
    "MaxAgeSeconds": 3600
  }
]