How to configure multiple S3 services in the same application with ExAws?

Hello,

In the context of our application, we use ExAws to manage images and documents with an S3 service. However, we need to access a second separate S3 service (each with their own configuration and access keys).

Elixir is still fairly new to me but it would seem at first glance that with ExAws or Waffle it is not possible to set up multiple configurations in the config.exs file.
Overriding configuration with ExAws.request/6 might be a solution but I’m not sure…

Could there be another way to configure multiple S3 services simultaneously? Or am I missing something?

Thanks

Generally I just pass the configuration into ExAws.request/2. You can still store the individual AWS configurations in config.exs and grab the single configuration you want with Application.get_env when invoking ExAws.request/2.

3 Likes

This is the correct approach. ExAws is designed to allow ad hoc config overrides through ExAws.request/2

2 Likes