MinIO: Connecting Ruby to MinIO
This documentation is part of the Getting started guide. You can view the complete guide here: How to begin using MinIO for S3-compatible object storage.
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use MinIO Object Storage solution that provides a host of benefits, including:
- Unlimited transfers.
- Simple, predictive, and transparent pricing.
- Customisable domain name secured with HTTPS (for example, https://object-storage.your-company.com).
- Effortless updates with just a click.
- Optimal performance and robust security powered by a private and dedicated VM.
- Available in 🇪🇺 Europe and 🇺🇸 USA.
Save time and simplify your life: it only takes 5 minutes to try Stackhero's MinIO Object Storage hosting solution!
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.