I'm trying to list or retrieve objects from an amazon bucket and I keep getting this error message:
(byebug) resp = s3.list_objects(bucket:'mp3list')
*** Aws::S3::Errors::PermanentRedirect Exception:
The bucket you are attempting to access must be addressed
using the specified endpoint.
Please send all future requests to this endpoint.
I can upload and delete files from the same bucket with no problem.
Does someone know how to specify that endpoint? and where?
My configuration of the s3 bucket:
Bucket: mp3play
Region: Frankfurt
Creation Date: Fri Dec 09 17:44:39 GMT+100 2016
Owner: aaa
Can list, upload, delete.
aws.rb >
Aws.config.update({
credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']),
region: 'eu-central-1'
})
# list buckets in Amazon S3
s3 = Aws::S3::Client.new
resp = s3.list_buckets
S3_BUCKET = resp.buckets[0]
resp.buckets.map(&:name)
S3 = Aws::S3::Resource.new(region: 'eu-central-1')
Add endpoint
key to config:
Aws.config.update({
credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']),
region: 'eu-central-1',
endpoint:'https://s3.eu-central-1.amazonaws.com'
})
The list of available endpoints by regions: http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.