The S3 storage driver supports Amazon S3 and S3-compatible storage services like DigitalOcean Spaces, MinIO, Cloudflare R2, and Backblaze B2. It provides scalable, reliable cloud storage with built-in redundancy.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/directus/directus/llms.txt
Use this file to discover all available pages before exploring further.
Installation
The S3 driver is included by default with Directus via the@directus/storage-driver-s3 package, which uses the AWS SDK v3.
Configuration
Configure S3 storage using environment variables:Configuration Options
The S3 bucket name where files will be stored.
AWS access key ID. If not provided, uses default AWS credential chain (environment variables, IAM roles, etc.).
AWS secret access key. Required if
key is provided.AWS region where the bucket is located (e.g.,
us-east-1, eu-west-1).Optional path prefix for all files within the bucket.
Custom S3 endpoint URL for S3-compatible services. Include protocol (http:// or https://).
Use path-style URLs instead of virtual-hosted-style. Required for some S3-compatible services.
Access Control List for uploaded files. Options:
private, public-read, public-read-write, authenticated-read, etc.Server-side encryption type:
AES256, aws:kms, or aws:kms:dsse.KMS key ID for encryption when using
aws:kms or aws:kms:dsse.Connection timeout in milliseconds. Default:
5000.Socket timeout in milliseconds. Default:
120000.Maximum number of concurrent sockets. Default:
500.Enable HTTP keep-alive. Default:
true.Chunk size for resumable uploads in bytes. Default:
5242880 (5 MiB). Minimum: 5242880 (5 MiB).Examples
Amazon S3
With Root Path
IAM Role (EC2/ECS)
Public Read Access
Server-Side Encryption
KMS Encryption
DigitalOcean Spaces
Cloudflare R2
MinIO
Backblaze B2
Features
Resumable Uploads
The S3 driver supports TUS resumable uploads using S3 multipart upload:- Automatic chunking of large files
- Resume interrupted uploads
- Maximum upload size: 5 TiB
- Maximum parts: 10,000
- Minimum part size: 5 MiB
Multipart Upload
The driver implements S3 multipart upload from/packages/storage-driver-s3/src/index.ts:68-587:
- Uploads are split into chunks
- Chunks are uploaded in parallel (max 60 concurrent)
- Failed parts can be retried independently
- Incomplete uploads can be aborted
Performance Optimization
The driver is optimized for high-concurrency environments from/packages/storage-driver-s3/src/index.ts:89-107:
- Custom connection pool with 500 max sockets (configurable)
- HTTP keep-alive enabled by default
- Configurable timeouts
- Efficient memory usage with streams
Best Practices
IAM Permissions
Minimum required IAM permissions:CORS Configuration
If accessing files directly from the browser:Bucket Lifecycle
Configure lifecycle rules to clean up incomplete multipart uploads:Cost Optimization
- Use S3 Intelligent-Tiering for automatic cost optimization
- Enable S3 Transfer Acceleration for faster uploads from distant regions
- Consider CloudFront CDN for frequently accessed files
- Monitor S3 request costs for high-traffic applications
Troubleshooting
Access Denied Errors
- Verify IAM permissions
- Check bucket policies
- Ensure credentials are correct
- Verify bucket exists in the specified region