MinIO: Connecting Ruby to MinIO

This documentation is part of the Getting started guide. View the full guide here: How to begin using MinIO for S3-compatible object storage.

👋 Welcome to the Stackhero documentation!

Stackhero provides a ready-to-use MinIO Object Storage platform designed for reliability and speed. Key advantages include:

  • Unlimited data transfers with no hidden costs.
  • Simple, predictable, and transparent pricing.
  • A custom domain name secured with HTTPS (for example, https://object-storage.your-company.com).
  • One-click, seamless updates that require no manual intervention.
  • High performance and security on private, dedicated infrastructure.
  • Available in both 🇪🇺 Europe and 🇺🇸 USA regions.

Streamline your workflow and reduce setup time: you can deploy Stackhero's MinIO Object Storage hosting in just 5 minutes.

First, install the AWS SDK gem:

gem install aws-sdk
bundle install

Below is a simple example demonstrating how to interact with MinIO using the AWS SDK in Ruby:

require 'aws-sdk'

Aws.config.update(
  endpoint: 'https://<XXXXXX>.stackhero-network.com',
  access_key_id: 'YOUR_ACCESS_KEY',
  secret_access_key: 'YOUR_SECRET_KEY',
  force_path_style: true,
  region: 'us-east-1'
)

rubys3_client = Aws::S3::Client.new

# put_object operation
rubys3_client.put_object(
  key: 'testobject',
  body: 'Hello from MinIO!',
  bucket: 'testbucket',
  content_type: 'text/plain'
)

# get_object operation
rubys3_client.get_object(
  bucket: 'testbucket',
  key: 'testobject',
  response_target: 'download_testobject'
)

print "Downloaded 'testobject' as 'download_testobject'."

For more details, check out the MinIO Ruby documentation.