How do I use the AWS SDK for Ruby with Wasabi?

You can use the AWS SDK for Ruby by pointing the endpoint to https://s3.wasabisys.com and following the instructions below.  

1. Download and install AWS SDK for Ruby

2. Create environment variables for your Wasabi keys

   export AWS_ACCESS_KEY_ID=<wasabi-access-key>
   export AWS_SECRET_ACCESS_KEY=<wasabi-secret-key>

3. Below is a sample code to create a bucket

    require 'aws-sdk-s3'

    s3 = Aws::S3::Client.new(
    access_key_id: ENV['AWS_ACCESS_KEY_ID'],
    secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
    region: 'us-east-1',
    endpoint: 'https://s3.wasabisys.com'
    )

    s3.create_bucket(bucket: '<bucket-name>')

4. Run the file with the following command

     ruby <file-name>.rb

Note that this example discusses the use of Wasabi's us-east-1 storage region. To use other Wasabi storage regions, please use the appropriate Wasabi service URL as described in this article

Have more questions? Submit a request