How to serve S3 or MinIO bucket over HTTP using rclone

Note: I recommend using nginx-s3-gateway for production setups instead of rclone. See MinIO/S3-backed static hosting using Traefik reverse proxy + nginx-s3-gateway for more information.

rclone is a powerful command-line tool to manage files on cloud storage. It can be used to serve S3 or MinIO buckets over HTTP.

The following commands provide directory listing but do not automatically use index.html as directory index. Be aware of the security implications when exposing your bucket over HTTP!

By default, they serve on http://*:8080

Serving MinIO over HTTP

#!/bin/bash
# Use Minio endpoint as the S3 provider
AWS_ACCESS_KEY_ID=my-access-key AWS_SECRET_ACCESS_KEY=oXeidoo3voS0laghai1Oos5xoo8She \
rclone serve http ":s3,provider=Minio,env_auth=true,endpoint=minio.mydomain.com:my-bucket-name" \
  --addr :8080 --read-only --no-modtime --vfs-cache-mode off --dir-cache-time 1m

Serving S3 over HTTP

#!/bin/bash
# Use S3 endpoint as the S3 provider
AWS_ACCESS_KEY_ID=my-access-key AWS_SECRET_ACCESS_KEY=oXeidoo3voS0laghai1Oos5xoo8She \
rclone serve http ":s3,provider=AWS,env_auth=true,region=$AWS_REGION:my-bucket-name" \
  --addr :8080 --read-only --no-modtime --vfs-cache-mode off --dir-cache-time 1m