Using aws-elixir and local Minio


I am trying to use aws-elixir to access local Minio, any example code to refer to?


Happy to help. What have you tried?

1 Like

Managed to get it working. Documenting the steps for others. If there is better way, please do let me know

  1. Running Minio locally at 9000
  2. Have the Client created as follows

iex(1)> client = AWS.Client.create(“id”, “key”, “localhost”)
iex(2)> client = %{client | port: 9000}
iex(3)> client = %{client | proto: “http”}
iex(4)> client = %{client | endpoint: “localhost”}

  region: "localhost",
  service: nil,
  endpoint: "localhost",
  proto: "http",
  port: 9000,
  http_client: {AWS.HTTPClient.Hackney, []},
  json_module: {AWS.JSON, []},
  xml_module: {AWS.XML, []},

Then used it to invoke

iex(5)> AWS.S3.create_bucket(client, “mybucket”, %{})

{:ok, nil,
   body: "",
   headers: [
     {"Server", "nginx/1.19.2"},
     {"Date", "Tue, 03 Oct 2023 22:30:21 GMT"},
     {"Content-Length", "0"},
     {"Connection", "keep-alive"},
     {"Accept-Ranges", "bytes"},
     {"Location", "/mybucket"},
     {"Strict-Transport-Security", "max-age=31536000; includeSubDomains"},
     {"Vary", "Origin"},
     {"Vary", "Accept-Encoding"},
     {"X-Amz-Request-Id", "178AB98C4ABCE5E0"},
     {"X-Content-Type-Options", "nosniff"},
     {"X-Xss-Protection", "1; mode=block"}
   status_code: 200