AWS S3:您尝试访问的存储桶必须使用指定的终端节点进行寻址 [英] AWS S3: The bucket you are attempting to access must be addressed using the specified endpoint
问题描述
我正在尝试使用 AWS-SDK-Core Ruby Gem 删除上传的图像文件.
I am trying to delete uploaded image files with the AWS-SDK-Core Ruby Gem.
我有以下代码:
require 'aws-sdk-core'
def pull_picture(picture)
Aws.config = {
:access_key_id => ENV["AWS_ACCESS_KEY_ID"],
:secret_access_key => ENV["AWS_SECRET_ACCESS_KEY"],
:region => 'us-west-2'
}
s3 = Aws::S3::Client.new
test = s3.get_object(
:bucket => ENV["AWS_S3_BUCKET"],
:key => picture.image_url.split('/')[-2],
)
end
但是,我收到以下错误:
However, I am getting the following error:
您尝试访问的存储桶必须使用指定的端点进行寻址.请将所有未来的请求发送到此端点.
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
我知道该区域是正确的,因为如果我将其更改为 us-east-1
,则会出现以下错误:
I know the region is correct because if I change it to us-east-1
, the following error shows up:
指定的键不存在.
我在这里做错了什么?
推荐答案
这个存储桶似乎是在不同的区域创建的,IE 不是 us-west-2.那是我唯一一次看到您尝试访问的存储桶必须使用指定的端点进行寻址.请将所有未来的请求发送到此端点."
It seems likely that this bucket was created in a different region, IE not us-west-2. That's the only time I've seen "The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint."
美国标准是 us-east-1
这篇关于AWS S3:您尝试访问的存储桶必须使用指定的终端节点进行寻址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!