Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Supported Clients

be9 edited this page Apr 24, 2012 · 34 revisions

Here are some of the snippets for various S3 clients in different languages.

Ruby

AWS-S3

AWS::S3::Base.establish_connection!(
       :access_key_id => "123",
       :secret_access_key => "abc",
       :server => "localhost",
       :port => "10001" )

Right AWS

 RightAws::S3Interface.new('1E3GDYEOGFJPIT7','hgTHt68JY07JKUY08ftHYtERkjgtfERn57',
                       {:multi_thread => false, :server => 'localhost',
                        :port => 10453, :protocol => 'http',:no_subdomains => true }

Fog

connection = Fog::Storage::AWS.new(aws_access_key_id: 123, aws_secret_access_key: 123, port: 10001, host: 'localhost', scheme: 'http')

I also needed the following monkeypatch to make it work.

  require 'fog/aws/models/storage/files'

  # fog always expects Last-Modified and ETag headers to present
  # We relax this requirement to support fakes3
  class Fog::Storage::AWS::Files
    def normalise_headers(headers)
      headers['Last-Modified'] = Time.parse(headers['Last-Modified']) if headers['Last-Modified']
      headers['ETag'].gsub!('"','') if headers['ETag']
    end
  end

Command Line Tools

s3cmd

For S3 cmd you need to setup your dns to contain subdomain buckets since it doesn't do path style S3 requests. You can use a config like this to make it work. Gist

Then just run s3cmd -c myconfig mb s3://my_bucket

Clone this wiki locally