PhxMediaLibrary.Storage.S3 (PhxMediaLibrary v0.6.1)

Copy Markdown View Source

Amazon S3 storage adapter.

Requires ex_aws and ex_aws_s3 dependencies. This module is only compiled when :ex_aws_s3 is available. If it is not installed, the module simply does not exist — configuring an S3 disk without the dependency will produce a clear "module is not available" error.

Configuration

config :phx_media_library,
  disks: [
    s3: [
      adapter: PhxMediaLibrary.Storage.S3,
      bucket: "my-bucket",
      region: "us-east-1",
      # Optional: Override ExAws config
      access_key_id: "...",
      secret_access_key: "..."
    ]
  ]

Options

  • :bucket - S3 bucket name (required)
  • :region - AWS region (default: from ExAws config)
  • :base_url - Custom base URL (for CDN)
  • :acl - Default ACL for uploads (default: "private")