Using S3-Compatible Object Storage

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.

VariableDescription
AWS_ACCESS_KEY_IDYour provider's access key.
AWS_SECRET_ACCESS_KEYYour provider's secret key.
AWS_DEFAULT_REGIONThe region for your storage (e.g., us-east-1).
AWS_BUCKETThe name of your bucket or space.
AWS_URLThe public base URL for accessing files, often a CDN endpoint.
AWS_ENDPOINTRequired. The full API endpoint URL of your S3-compatible service.
AWS_USE_PATH_STYLE_ENDPOINTSet 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

  1. Create a Space in your desired region.
  2. Generate an Access Key and Secret Key under API > Spaces Keys.
  3. Set the environment variables in your .env file:
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 nyc3 with your Space's region (e.g., sfo2, ams3).
  • The AWS_URL can be the origin URL or your custom CDN URL.

Backblaze B2

  1. Create a bucket in your Backblaze B2 account.
  2. Create an Application Key with access to that bucket to get a keyID and applicationKey.
  3. Note your bucket's S3 endpoint (e.g., s3.us-west-004.backblazeb2.com).
  4. 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-004 with your bucket's region.
  • The AWS_URL is typically your bucket's S3 URL.

MinIO (Self-Hosted)

  1. Ensure your MinIO server is running and accessible.
  2. Create a bucket and an access key/secret key.
  3. 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:9000 with the actual URL and port of your MinIO server.
  • The AWS_URL must include the bucket name at the end because of the path-style endpoint.
  • Set AWS_USE_PATH_STYLE_ENDPOINT to true.
  • The AWS_DEFAULT_REGION can be set to any valid AWS region string, as it's required by the driver but not used by MinIO for region selection.

Search documentation

Find guides and reference pages