Storage.Services.S3 (PhoenixContribStorage v0.1.0)

View Source

Amazon S3 storage service implementation.

Requires the following dependencies to be added to your mix.exs:

{:ex_aws, "~> 2.4"},
{:ex_aws_s3, "~> 2.4"},
{:hackney, "~> 1.18"},
{:sweet_xml, "~> 0.7"}

Configuration

config :phoenix_contrib_storage,
  services: %{
    s3: {Storage.Services.S3, 
      bucket: "my-bucket",
      region: "us-east-1",
      access_key_id: {:system, "AWS_ACCESS_KEY_ID"},
      secret_access_key: {:system, "AWS_SECRET_ACCESS_KEY"}
    }
  }

Summary

Functions

Checks if an object exists in S3.

Gets object metadata without downloading the file.

Lists objects in the bucket with optional prefix.

Generates a signed URL for direct uploads.

Functions

exists?(key, config)

Checks if an object exists in S3.

head_object(key, config)

Gets object metadata without downloading the file.

list_objects(config, opts \\ [])

Lists objects in the bucket with optional prefix.

signed_upload_url(key, config, opts \\ [])

Generates a signed URL for direct uploads.