Configuring AWS with Minio

I’m trying to set up Shrine with the AWS storage option, using a Minio instance set up by someone else. All I have is the base URL of the server, my key and secret key, and a bucket or three.

I initially tried using the endpoint to configure this, which I gather steps around the whole system of concatenating the URL together from the parts, but that hasn’t worked yet. I am getting a socket error:

## Encountered a `SocketError` while attempting to connect to: This is typically the result of an invalid `:region` option or a poorly formatted `:endpoint` option.

test3 is the name of the bucket, and I can see that bucket when I use the minio command-line.

Here’s the entirety of my initializer:

require "shrine"
require "shrine/storage/s3"
s3_options = { 
  endpoint:          "",
  bucket:            "test3", # required 
  region:            "us-east", # required 
  access_key_id:     "REDACTED",
  secret_access_key: "ALSO_REDACTED",
Shrine.storages = { 
  cache: "cache", **s3_options), # temporary 
  store:**s3_options),                  # permanent 

Shrine.plugin :activerecord           # loads Active Record integration
Shrine.plugin :cached_attachment_data # enables retaining cached file across form redisplays
Shrine.plugin :restore_cached_data    # extracts metadata for assigned cached files

Is there another key where I can put in just the hostname, and get this to work?

Thanks in advance,


Aha. It’s just been pointed out to me that the answer is in my error message. I actually accidentally redacted that when I was composing my question. I missed the place where it had used the “bucket subdomain” format, and what was really in the error was I think I can find the setting to turn off the prefixing. I used that in another app already.


Fixed, with force_path_style: true.

Thanks, you’ve been excellent rubber ducks!


1 Like