S3 & Cloudflare R2 Configuration

LaunchKit supports both Amazon S3 and Cloudflare R2 as cloud storage backends. Both use the S3-compatible API, making them interchangeable with minimal configuration changes.

Amazon S3

To use S3, set the storage driver to s3 and provide your AWS credentials:

AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=your-bucket-name

These values can also be configured from the admin panel under storage settings:

  • storage.drivers3
  • storage.s3.key → AWS access key ID
  • storage.s3.secret → AWS secret access key
  • storage.s3.region → AWS region
  • storage.s3.bucket → S3 bucket name

Cloudflare R2

Cloudflare R2 is S3-compatible and uses the same SDK. The main difference is the custom endpoint URL:

R2_ACCESS_KEY_ID=your-r2-access-key
R2_SECRET_ACCESS_KEY=your-r2-secret-key
R2_BUCKET=your-r2-bucket
R2_ENDPOINT=https://your-account-id.r2.cloudflarestorage.com

Admin panel settings:

  • storage.driverr2
  • storage.r2.key → R2 access key ID
  • storage.r2.secret → R2 secret access key
  • storage.r2.bucket → R2 bucket name
  • storage.r2.endpoint → R2 endpoint URL

Runtime Configuration

When storage settings are changed from the admin panel, the StorageManager reconfigures Laravel's filesystem disks at runtime. No application restart or redeployment is needed.

The admin panel settings take precedence over .env values. If no admin settings are configured, the system falls back to the environment variables.

Choosing Between S3 and R2

  • S3 — mature ecosystem, extensive region coverage, deep AWS integration
  • R2 — zero egress fees, S3-compatible API, integrated with Cloudflare CDN

Both drivers support all LaunchKit file operations including uploads, signed URLs, and file deletion.