gpt4 book ai didi

ruby-on-rails - 永久重定向异常 : aws-sdk s3 Rails 5

转载 作者:数据小太阳 更新时间:2023-10-29 08:07:08 25 4
gpt4 key购买 nike

我正在尝试从亚马逊存储桶中列出或检索对象,但我不断收到此错误消息:

(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.

我可以毫无问题地从同一个存储桶上传和删除文件。

有人知道如何指定该端点吗?在哪里?

我的 s3 存储桶配置:

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')

最佳答案

端点键添加到配置中:

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'
})

按地区划分的可用端点列表:http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

关于ruby-on-rails - 永久重定向异常 : aws-sdk s3 Rails 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41071208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com