cortfritz

cortfritz

Receiving 301 redirected when listing bucket contents with ExAws

I’m using the latest versions of ExAws and ExAws.S3. I have configured access key, secret key, and region via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_REGION, respectively. The keys I am using have Administrator Access in AWS.

I am experimenting in a local iex session.

I can get a list of buckets via:

ExAws.S3.list_buckets() |> ExAws.request!()

…but I cannot get contents via:

ExAws.S3.list_objects_v2("my_bucket_name") |> ExAws.request!()

I get:

15:04:55.211 module=ExAws.Request [warning] ExAws: Received redirect, did you specify the correct region?
** (ExAws.Error) ExAws Request Error!

{:error, {:http_error, 301, "redirected"}}

    (ex_aws 2.2.3) lib/ex_aws.ex:87: ExAws.request!/2
    iex:1: (file)

I have verified via AWS console and from the above Elixir code that the bucket exists.

Can anyone please advise on how to make this work?

Most Liked

cortfritz

cortfritz

Thanks @benwilson512 and @dimitarvp!

My app has a custom config management scheme and we tripped over it.

Where we needed:

config :ex_aws,
  access_key_id: ...

I instead had:

config :custom_atom_from_config_scheme,
  access_key_id: ...

…and got confused about what was set, where.

Going forward will move to modern best practice Elixir config management so as to not post confusion here (as often).

Thank you again!

dimitarvp

dimitarvp

Whoops, it was a very stupid copy-paste mistake, apologies. Seems both me and @cortfritz derped big time. I’ll have him change his config as well and it should work right away.

Thanks for making me double-check.

Where Next?

Popular in Questions Top

LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
New
logicmason
Hi there, I'm working through my first release with elixir/phoenix. I've built a release with distillery and found that it crashes when I...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement