CONNECTION REFUSED – CONNECT(2) AWS S3 Paperclip Development Error

In the last day I have been trying to set up an AWS S3 Bucket where I can upload my assets – mainly images from my web apps. I had some difficultly with some error where I could not find the answer for a long time – eventually I arrived at a solution.

The error?


Every stack overflow post seem useless, and all stated the same thing about setting defaults etc.

  config.paperclip_defaults = {
    :storage => :s3,
    :s3_credentials => {
      :bucket => ENV['AWSBucketName'],
      :access_key_id => ENV['AWS_ACCESS_KEY_ID'],
      :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']

None of that really helped, though. My server was based in Ireland, as is my web app – so I think the solution was quite UK/Europe specific. Mainly I had the host name incorrect. Here was the line missing from my paperclip.rb file (solution was found here) :

Paperclip::Attachment.default_options[:s3_host_name] = ''

Adding this and making sure the bucket was set up for Ireland was the answer. Took a while but I finally got there.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s