Setting ExAws configuration at runtime

I’ve been diving deep into Elixir the past few weeks and decided to get my hands dirty by writing an api I had previously written in GO in Elixir. Part of the functionality is that a user can provide their own AWS access and secret keys to be used when ever dealing with any of their data. Currently reading the docs for ExAws they only show how to set up configuration in the config file. For my use case though I need to set up a AWS session at runtime depending on the user making the request. Does anyone know how this can be achieved with ExAws? I’ve seen alternative libraries that allow me to do this but ExAws seems to be the default AWS client lib so I would prefer to stick with it. Thanks!

:wave:

I think it’s possible to provide config overrides to the request/2 function.

So something like

config_overrides = [access_key_id: aws_key_id, secret_access_key: aws_secret]
ExAws.request(op, config_overrides)

might work.

3 Likes

Thank you so much! Dig the username btw :joy: