Search code examples
ruby-on-railsrails-activestorage

Rails ActiveStorage Using Custom S3 API


I want to use Rails ActiveStorage, but I am using non-AWS S3 API object storage.

amazon:
  service: S3
  access_key_id: ""
  secret_access_key: ""
  region: ""
  bucket: ""

On the documentation, it says that we need the region, my S3 API has no region. Is the any way to use custom S3 API?


Solution

  • I solved it by using the endpoint key on the configuration file. It look like this.

    amazon:
      service: S3
      access_key_id: "123"
      secret_access_key: "asd"
      endpoint: "http://192.168.1.201:30103"
      bucket: "test"
    

    Do not need to use any region since there is not any. I found it at the bottom of the S3 Ruby gem AWS documentation https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html