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

Supported Clients

cjc343 edited this page Dec 4, 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 }

AWS-SDK

AWS::S3.new(
    :access_key_id => 'YOUR_ACCESS_KEY_ID',
    :secret_access_key => 'YOUR_SECRET_ACCESS_KEY',
    :s3_endpoint => 'localhost',
    :s3_port => '10001',
    :use_ssl => false)

If you've disabled SSL as part of an AWS.config call and attempt to use services that have not been redirected (such as STS) you will need to enable SSL for those services. Note that this configuration has not been extensively tested with non-S3 services from the AWS-SDK gem.

Fog

connection = Fog::Storage::AWS.new(aws_access_key_id: 123, aws_secret_access_key: "asdf", 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