How can I connect to multiple S3 compatible Storage endpoints at runtime?

I want to connect to multiple minio (S3 compatible Storage) endpoints. (The credentials are stored in the Database)

I found the library ExAws, which fits my requirements, but it’s required to specify the s3 credentials in the config.exs afaik. I also found MinioEx, which is able to connect to multiple s3 endpoints and specify the credentials at runtime, but the Operations are too limited for my use.

I’m still pretty new to Elixir and the ExAws Libary, so maybe I overlooked how I could connect to other s3 endpoints at runtime.

While this is the default documented way it’s not a requirement at all. You can pass the credentials to ExAWS.request.

5 Likes

Seems like I misunderstood the Documentation. Thanks. This is an example I came up with:

example_minio = %{
  scheme: "http://",
  host: "localhost",
  port: 9000,
  access_key_id: "admin",
  secret_access_key: "password"
}

buckets = ExAws.S3.list_buckets()
  |> ExAws.request!(example_minio)