Has anyone been able to get ExAws.S3 to work with a bucket that is not in us-east-1
?
I’d like to simply list the contents of a bucket that is in Frankfurt (eu-central-1
), and I get this error: The authorization header is malformed; the region 'us-east-1' is wrong; expecting 'eu-central-1'
With erlcloud this works fine.
I’m facing this issue with ExAws 2.0.2 and ExAwsS3 2.0.0. Does anyone have any pointers on what I am doing wrong here?
Steps to Reproduce
Create a bucket in the Frankfurt (eu-central-1) region
-
Add some objects to the bucket
-
Try to list the bucket contents by doing a
ExAws.S3.list_objects("my-bucket-name") |> ExAws.request!
Expected Result
I should see the contents of the bucket.
Actual Results
The following error is seen:
** (ExAws.Error) ExAws Request Error!
{:error, {:http_error, 400, %{body: "<?xml version=\"1.0\"
encoding=\"UTF-8\"?>\n<Error><Code>AuthorizationHeaderMalformed</Code><Message>The
authorization header is malformed; the region 'us-east-1' is wrong;
expecting 'eu-central-1'</Message><Region>eu-central-1</Region>
...
{"Server", "AmazonS3"}], status_code: 400}}}
(ex_aws) lib/ex_aws.ex:66: ExAws.request!/2
Additional Information
My config.exs looks like this:
...
config :ex_aws,
access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, {:awscli, "prod", 30}, :instance_role],
secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, {:awscli, "prod", 30}, :instance_role],
region: "eu-central-1"
config :ex_aws, :s3,
scheme: "https://",
host: "s3.eu-central-1.amazonaws.com",
region: "eu-central-1"