Linus Linus - 5 months ago 34
Ruby Question

Upload files to AWS S3 with plain Ruby

I'm trying to list the files in the bucket named

0-test
on S3 using the
aws-sdk
gem. This is my code:

require require 'aws-sdk'

Aws.config.update({
region: 'Ireland',
credentials: Aws::Credentials.new(key, key2)
})

s3 = Aws::S3::Client.new
print s3.list_buckets


This is the (important part of the) error I get:

/Users/user/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http.rb:879:in `initialize': unable to connect to `s3.ireland.amazonaws.com`; SocketError: getaddrinfo: nodename nor servname provided, or not known (Seahorse::Client::NetworkingError)


What am I missing? Thanks!

Answer

Your region name is incorrect. While that region is colloquially known as Ireland, the API name is eu-west-1. There is a full list of regions here

Comments