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 credentialssecretAccessKey
(required): Provide Secret Access Key from your service credentialsregion = 'us-east-1
: Provide your service regionisPublic = false
: Specify a bucket ACLendpoint
: 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
}
]