Storage

S3 Uploads

Learn how to upload files to Supabase Storage using S3.


You can use the S3 protocol to upload files to Supabase Storage. To get started with S3, see the S3 setup guide.

The S3 protocol supports file upload using:

  • A single request
  • Multiple requests via Multipart Upload

Single request uploads

The PutObject action uploads the file in a single request. This matches the behavior of the Supabase SDK Standard Upload.

Use PutObject to upload smaller files, where retrying the entire upload won't be an issue. The maximum file size on paid plans is 50 GB.

For example, using JavaScript and the aws-sdk client:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3'const s3Client = new S3Client({...})const file = fs.createReadStream('path/to/file')const uploadCommand = new PutObjectCommand({ Bucket: 'bucket-name', Key: 'path/to/file', Body: file, ContentType: 'image/jpeg',})await s3Client.send(uploadCommand)

Multipart uploads

Multipart Uploads split the file into smaller parts and upload them in parallel, maximizing the upload speed on a fast network. When uploading large files, this allows you to retry the upload of individual parts in case of network issues.

This method is preferable over Resumable Upload for server-side uploads, when you want to maximize upload speed at the cost of resumability. The maximum file size on paid plans is 50 GB.

Upload a file in parts

Use the Upload class from an S3 client to upload a file in parts. For example, using JavaScript:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { S3Client } from '@aws-sdk/client-s3'import { Upload } from '@aws-sdk/lib-storage'const s3Client = new S3Client({...})const file = fs.createReadStream('path/to/very-large-file')const upload = new Upload(s3Client, { Bucket: 'bucket-name', Key: 'path/to/file', ContentType: 'image/jpeg', Body: file,})await uploader.done()

Aborting multipart uploads

All multipart uploads are automatically aborted after 24 hours. To abort a multipart upload before that, you can use the AbortMultipartUpload action.