Backblaze and ex_aws/ex_aws_s3 2.4.3 presign url issue

Does ex_aws(2.4.3) support backblaze s3 api out the box? I’m trying to obtain a presigned url via the backblaze s3 api like so but I’m ultimately getting this error: s3 not supported in region us-east-005 for partition aws

config:

config :ex_aws,
  json_codec: Jason,
  debug_request: true,
  access_key_id: "asdf",
  secret_access_key: "asdf",
  s3: [
    scheme: "https://",
    host: "https://s3.us-east-005.backblazeb2.com",
    region: "us-east-005"
  ]

input:

iex(4)> query_params = [{"ContentType", MIME.from_path("output.mp4")}, {"x-amz-acl", "public-read"}]                                    
[{"ContentType", "video/mp4"}, {"x-amz-acl", "public-read"}]
iex(5)> presign_options = [query_params: query_params, virtual_host: false]                                                                   
[
  query_params: [{"ContentType", "video/mp4"}, {"x-amz-acl", "public-read"}],
  virtual_host: false
]
iex(6)> {:ok, presigned_url} = ExAws.Config.new(:s3) |> ExAws.S3.presigned_url(:put, "bucket-media-main", "output.mp4", presign_options)

error:

But this seems to result in an error inside ex_aws:

** (RuntimeError) s3 not supported in region us-east-005 for partition aws
    (ex_aws 2.4.3) lib/ex_aws/config/defaults.ex:175: ExAws.Config.Defaults.fetch_or/3
    (ex_aws 2.4.3) lib/ex_aws/config/defaults.ex:158: ExAws.Config.Defaults.do_host/3
    (ex_aws 2.4.3) lib/ex_aws/config/defaults.ex:89: ExAws.Config.Defaults.get/2
    (ex_aws 2.4.3) lib/ex_aws/config.ex:96: ExAws.Config.build_base/2
    (ex_aws 2.4.3) lib/ex_aws/config.ex:69: ExAws.Config.new/2
    iex:6: (file)

Is this backblaze, a config issue or does ex_aws just not support backblaze?

It works for me with the following config. I think you don’t have to specify the region:

config :ex_aws, :s3,
  access_key_id: [""],
  secret_access_key: [""],
  host: "s3.eu-central-003.backblazeb2.com",
  bucket: ""
2 Likes

Success, thanks that saved me a bunch of time.

1 Like