Using S3-Compatible Object Storage
ElmapiCMS's S3 driver can be configured to work with any cloud storage provider that offers an S3-compatible API. This allows you to use services like DigitalOcean Spaces, Backblaze B2, Wasabi, or even a self-hosted MinIO server for your project's Asset Library.
General Configuration
The setup is nearly identical to configuring AWS S3, with one key difference: you must specify the service's API endpoint. You will provide your credentials and bucket details using the same AWS_ prefixed variables in your .env file.
| Variable | Description |
|---|---|
AWS_ACCESS_KEY_ID | Your provider's access key. |
AWS_SECRET_ACCESS_KEY | Your provider's secret key. |
AWS_DEFAULT_REGION | The region for your storage (e.g., us-east-1). |
AWS_BUCKET | The name of your bucket or space. |
AWS_URL | The public base URL for accessing files, often a CDN endpoint. |
AWS_ENDPOINT | Required. The full API endpoint URL of your S3-compatible service. |
AWS_USE_PATH_STYLE_ENDPOINT | Set to true for some services like MinIO. Defaults to false. |
After updating your .env file, remember to select AWS S3 as the Default Storage in your Project Settings.
Provider Examples
Here are common configurations for popular services.
DigitalOcean Spaces
- Create a Space in your desired region.
- Generate an Access Key and Secret Key under API > Spaces Keys.
- Set the environment variables in your
.envfile:
AWS_ACCESS_KEY_ID=YOUR_DO_ACCESS_KEY
AWS_SECRET_ACCESS_KEY=YOUR_DO_SECRET_KEY
AWS_DEFAULT_REGION=nyc3
AWS_BUCKET=your-space-name
AWS_URL=https://your-space-name.nyc3.cdn.digitaloceanspaces.com
AWS_ENDPOINT=https://nyc3.digitaloceanspaces.com- Replace
nyc3with your Space's region (e.g.,sfo2,ams3). - The
AWS_URLcan be the origin URL or your custom CDN URL.
Backblaze B2
- Create a bucket in your Backblaze B2 account.
- Create an Application Key with access to that bucket to get a
keyIDandapplicationKey. - Note your bucket's S3 endpoint (e.g.,
s3.us-west-004.backblazeb2.com). - Set the environment variables:
AWS_ACCESS_KEY_ID=YOUR_B2_KEY_ID
AWS_SECRET_ACCESS_KEY=YOUR_B2_APPLICATION_KEY
AWS_DEFAULT_REGION=us-west-004
AWS_BUCKET=your-b2-bucket-name
AWS_URL=https://your-b2-bucket-name.s3.us-west-004.backblazeb2.com
AWS_ENDPOINT=https://s3.us-west-004.backblazeb2.com- Replace
us-west-004with your bucket's region. - The
AWS_URLis typically your bucket's S3 URL.
MinIO (Self-Hosted)
- Ensure your MinIO server is running and accessible.
- Create a bucket and an access key/secret key.
- Set the environment variables. For MinIO, you must enable path-style endpoints.
AWS_ACCESS_KEY_ID=YOUR_MINIO_ACCESS_KEY
AWS_SECRET_ACCESS_KEY=YOUR_MINIO_SECRET_KEY
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your-minio-bucket-name
AWS_URL=http://your-minio-domain:9000/your-minio-bucket-name
AWS_ENDPOINT=http://your-minio-domain:9000
AWS_USE_PATH_STYLE_ENDPOINT=true- Replace
http://your-minio-domain:9000with the actual URL and port of your MinIO server. - The
AWS_URLmust include the bucket name at the end because of the path-style endpoint. - Set
AWS_USE_PATH_STYLE_ENDPOINTtotrue. - The
AWS_DEFAULT_REGIONcan be set to any valid AWS region string, as it's required by the driver but not used by MinIO for region selection.