# File lib/fog/storage/aws.rb, line 219
        def initialize(options={})
          require 'fog/core/parser'
          require 'mime/types'

          @aws_access_key_id = options[:aws_access_key_id]
          @aws_secret_access_key = options[:aws_secret_access_key]
          @hmac = Fog::HMAC.new('sha1', @aws_secret_access_key)
          if @endpoint = options[:endpoint]
            endpoint = URI.parse(@endpoint)
            @host = endpoint.host
            @path = endpoint.path
            @port = endpoint.port
            @scheme = endpoint.scheme
          else
            options[:region] ||= 'us-east-1'
            @host = options[:host] || case options[:region]
            when 'ap-northeast-1'
              's3-ap-northeast-1.amazonaws.com'
            when 'ap-southeast-1'
              's3-ap-southeast-1.amazonaws.com'
            when 'eu-west-1'
              's3-eu-west-1.amazonaws.com'
            when 'us-east-1'
              's3.amazonaws.com'
            when 'us-west-1'
              's3-us-west-1.amazonaws.com'
            else
              raise ArgumentError, "Unknown region: #{options[:region].inspect}"
            end
            @path   = options[:path]      || '/'
            @port   = options[:port]      || 443
            @scheme = options[:scheme]    || 'https'
            unless options.has_key?(:persistent)
              options[:persistent] = true
            end
          end
          @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", options[:persistent])
        end