Reputation: 639
I'm trying to upload images using Amazon S3 into the bucket I created. However, I keep getting an error message - Connection refused - connect(2) for "s3-website-us-west-1" port 443
I put this in the config/environments/production.rb file
config.paperclip_defaults = {
:storage => :s3,
:s3_credentials => {
:bucket => 'mybucketname', #ENV['S3_BUCKET_NAME'],
:access_key_id => 'myaccesskey'
:secret_access_key => 'mysecretkey'
}
This is what have in the initilizers paperclip.rb file
Paperclip::Attachment.default_options[:url] = 'mybucketname.com.s3-website-us-west-1.amazonaws.com'
Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
Paperclip::Attachment.default_options[:s3_host_name] = 's3-website-us-west-1'
I also set the IAM user to have AmazonS3FullAccess and AdministratorAccess as the Policy Permissions. Thanks,
Upvotes: 1
Views: 884
Reputation: 178974
The website endpoints don't support https or uploads -- they're only for downloads. You're looking for the REST endpoint, which should be s3-eu-west-1
, assuming that's your bucket location, and possibly followed by .amazonaws.com
, depending on what that library expects.
http://docs.aws.amazon.com/AmazonS3/latest/dev/MakingRequests.html#RequestEndpoints
http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html
Upvotes: 3