RustFS: Connecting Ruby to RustFS
This documentation is part of the Quick start guide guide. You can view the complete guide here: How to begin using RustFS for S3-compatible object storage.
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use RustFS Object Storage platform, engineered for reliability and speed. Key benefits include:
- Unlimited data transfers with no hidden fees.
- Simple, predictable, and transparent pricing.
- A custom domain name secured with HTTPS (for example, https://object-storage.your-company.com).
- A web console and admin API that you can restrict from the internet with a single click.
- Smooth, one-click updates with no manual intervention required.
- High performance and security on private, dedicated infrastructure.
- Available in both 🇪🇺 Europe and 🇺🇸 USA regions.
Optimise your workflow and reduce setup time: you can deploy Stackhero's RustFS Object Storage hosting in just 5 minutes.
First, install the AWS SDK gem:
gem install aws-sdk-s3
Here is a simple example to interact with RustFS using the AWS SDK in Ruby:
require 'aws-sdk-s3'
s3 = Aws::S3::Client.new(
endpoint: 'https://<XXXXXX>.stackhero-network.com',
access_key_id: '<ROOT_ACCESS_KEY>',
secret_access_key: '<ROOT_SECRET_KEY>',
force_path_style: true,
region: 'us-east-1'
)
# Create a bucket
s3.create_bucket(bucket: 'testbucket')
# Upload an object
s3.put_object(
bucket: 'testbucket',
key: 'testobject',
body: 'Hello from RustFS!',
content_type: 'text/plain'
)
# Download the object to a local file
s3.get_object(
bucket: 'testbucket',
key: 'testobject',
response_target: 'download_testobject'
)
puts "Downloaded 'testobject' as 'download_testobject'."