# AWS Ruby SDK

<!-- -->

This guide assumes that you have followed the steps in the [Getting Started](/docs/get-started/.md) guide, and have the access keys available.

You may continue to use the AWS Ruby SDK as you normally would, but with the endpoint set to Tigris at <https://t3.storage.dev>. Also make sure `force_path_style` is set to false:

```
s3 = Aws::S3::Client.new(

    region: "auto",

    endpoint: "https://t3.storage.dev",

    force_path_style: false,

)
```

This example uses the [AWS Ruby SDK v3](https://github.com/aws/aws-sdk-ruby) and reads the default credentials file or the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.

<!-- -->

```
# frozen_string_literal: true



source "https://rubygems.org"



gem 'nokogiri', '~> 1.18'

gem 'aws-sdk-s3', '~> 1'
```

Then you can use the SDK as you normally would, but with the endpoint set to Tigris at <https://t3.storage.dev>.

<!-- -->

```
require "aws-sdk-s3"



bucket_name = "tigris-example"



s3 = Aws::S3::Client.new(

    region: "auto",

    endpoint: "https://t3.storage.dev",

)



# Lists all of your buckets

resp = s3.list_buckets

puts "My buckets now are:\n\n"



resp.buckets.each do |bucket|

    puts bucket.name

end



# List the first ten objects in the bucket

resp = s3.list_objects(bucket: bucket_name, max_keys: 10)

resp.contents.each do |object|

    puts "#{object.key} => #{object.etag}"

end



# Put an object into the bucket

file_name = "bar-file-#{Time.now.to_i}"

begin

    s3.put_object(

        bucket: bucket_name,

        key: file_name,

        body: File.read("getting_started.rb")

    )

    puts "Uploaded #{file_name} to #{bucket_name}."

rescue Exception => e

    puts "Failed to upload #{file_name} with error: #{e.message}"

    exit "Please fix error with file upload before continuing."

end
```

## Presigned URLs[​](#presigned-urls "Direct link to Presigned URLs")

Presigned URLs are supported by the AWS Ruby SDK. You can generate a presigned URL by calling the `presigned_url` method on a Bucket object.

<!-- -->

```
require "aws-sdk-s3"



s3 = Aws::S3::Client.new(

    region: "auto",

    endpoint: "https://t3.storage.dev",

    force_path_style: false,

)



bucket_name = "tigris-example"

bucket = Aws::S3::Bucket.new(name: bucket_name, client: s3)



presigned_url = bucket.object("test-object").presigned_url(:get, expires_in: 3600)

puts "Presigned URL for GET: #{presigned_url}"
```

### Presigned URLs with custom domains[​](#presigned-urls-with-custom-domains "Direct link to Presigned URLs with custom domains")

You can also use a [presigned URL with a custom domain](/docs/objects/presigned/.md#presigned-url-with-custom-domain) by replacing the Tigris domain name with your custom domain name:

```
branded_url = presigned_url.gsub("t3.storage.dev", "your-domain.example.com")

puts "Presigned URL for GET (custom domain): #{branded_url}"
```
