What gets stored in S3
When configured, S3 storage is used for:- Snapshot exports: Database backups and exports
- Snapshot imports: Data imports and migrations
- Function modules: Compiled JavaScript/TypeScript code
- User files: Files uploaded through the file storage API
- Search indexes: Full-text search index data
Supported storage providers
- AWS S3: Native S3 support
- Cloudflare R2: S3-compatible storage
- MinIO: Self-hosted S3-compatible storage
- DigitalOcean Spaces: S3-compatible storage
- Backblaze B2: S3-compatible storage
- Other S3-compatible providers
S3 setup (AWS)
1
Create S3 buckets
Create the following buckets in your AWS region:
2
Create IAM user and credentials
Create an IAM user with programmatic access and attach a policy with permissions for these buckets:
3
Configure environment variables
Add to your
.env file:.env
4
Restart the backend
Cloudflare R2 setup
Cloudflare R2 offers S3-compatible storage with zero egress fees.1
Create R2 buckets
In the Cloudflare dashboard, create the following R2 buckets:
convex-snapshot-exportsconvex-snapshot-importsconvex-modulesconvex-user-filesconvex-search-indexes
2
Create API token
Create an R2 API token with read and write permissions for your buckets.
3
Configure environment variables
Add to your Replace
.env file:.env
account-id with your Cloudflare account ID from the R2 dashboard.4
Restart the backend
MinIO setup (self-hosted)
MinIO is an open-source S3-compatible storage server you can self-host.1
Run MinIO
2
Create buckets
Access the MinIO console at
http://localhost:9001 and create the required buckets, or use the CLI:3
Configure environment variables
.env
Environment variable reference
Required variables
string
required
AWS region where your S3 buckets are located. Use
auto for Cloudflare R2.string
required
Access key ID for S3 authentication.
string
required
Secret access key for S3 authentication.
Bucket configuration
string
required
S3 bucket name for snapshot exports.
string
required
S3 bucket name for snapshot imports.
string
required
S3 bucket name for function modules.
string
required
S3 bucket name for user files.
string
required
S3 bucket name for search indexes.
Optional configuration
string
Custom S3 endpoint URL. Required for S3-compatible services like R2, MinIO, etc.
string
Session token for temporary AWS credentials (e.g., when using IAM roles).
boolean
Force path-style S3 URLs instead of virtual-hosted style.Required for Cloudflare R2 and most S3-compatible services.
boolean
Disable server-side encryption for S3 objects.Useful for MinIO and other self-hosted solutions.
boolean
Disable checksums for S3 operations.
Migrating storage providers
If you’re switching between local storage and S3 storage (or between different S3 providers), you need to export and import your data.1
Export from current backend
2
Set up new storage provider
Configure your new S3 buckets and environment variables as described above.
3
Restart backend with new storage
4
Import data to new backend
Bucket organization
You can use a single bucket with different prefixes or separate buckets for each type of data. The examples above use separate buckets for better organization and access control.Single bucket approach
.env
Multiple buckets approach (recommended)
.env
- Granular access control
- Independent lifecycle policies
- Easier cost tracking
- Better organization
Security best practices
- Use IAM roles when possible: Instead of access keys, use IAM roles for EC2, ECS, or other AWS services
- Restrict bucket access: Use bucket policies to restrict access to your backend’s IP or VPC
- Enable encryption: Use server-side encryption (SSE-S3 or SSE-KMS) for sensitive data
- Rotate credentials: Regularly rotate your access keys
- Use separate buckets per environment: Don’t share buckets between development, staging, and production
- Enable versioning: Protect against accidental deletions
- Set lifecycle policies: Automatically delete old exports and reduce costs
Verification
After configuring S3 storage:1
Check backend logs
2
Test file upload
Use the Convex file storage API to upload a test file and verify it appears in your S3 bucket.
3
Test export
Troubleshooting
Access denied errors
- Verify credentials: Check that your AWS access key and secret are correct
- Check IAM permissions: Ensure your IAM user/role has the required S3 permissions
- Verify bucket names: Ensure bucket names are correct and exist
- Check bucket policies: Verify bucket policies don’t block access
Connection timeout errors
- Check endpoint URL: Ensure
S3_ENDPOINT_URLis correct for your provider - Verify network access: Ensure your backend can reach the S3 endpoint
- Check firewall rules: Verify outbound connections to S3 are allowed
Path style errors
If you see errors about virtual-hosted style vs path style:Example configurations
Production with AWS S3
.env
Production with Cloudflare R2
.env
Local development with MinIO
.env
Next steps
Configuration
Explore all runtime configuration options
Database setup
Configure PostgreSQL or MySQL