Last Updated: February 25, 2016
·
2.894K
· kubabogaczewicz

Setting S3 region in Carrierwave

When setting Fog S3 credentials in Carrierwave initializer remember to use developer area codes, not human names.

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => 'AWS',
    :aws_access_key_id      => ENV['S3_ACCESS_KEY_ID'],
    :aws_secret_access_key  => ENV['S3_SECRET_KEY_ID'],
    :region                 => 'eu-west-1' # not Ireland
  }
  config.fog_directory  = ENV['S3_BUCKET']
end

Otherwise you will get OpenSSL "hostname does not match certificate" errors.