On this page

This guide assumes that you have followed the steps in the [Getting Started](/content/docs/get-started/index.html) 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](https://t3.storage.dev/). Also make sure `force_path_style` is set to false:

```ruby
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`.

```ruby
# 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](https://t3.storage.dev/).

```ruby
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 are supported by the AWS Ruby SDK. You can generate a presigned URL by calling the `presigned_url` method on a Bucket object.

```ruby
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

You can also use a [presigned URL with a custom domain](/content/docs/objects/presigned/#presigned-url-with-custom-domain/index.html) by replacing the bucket host with your custom domain:

```ruby
branded_url = presigned_url.gsub(

"foo-bucket.t3.storage.dev", "your-domain.example.com")

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

- [Presigned URLs](/content/docs/sdks/s3/aws-ruby-sdk/#presigned-urls/index.html)  
  - [Presigned URLs with custom domains](/content/docs/sdks/s3/aws-ruby-sdk/#presigned-urls-with-custom-domains/index.html)
