AWS S3:您尝试访问该桶必须使用指定的端点解决 [英] AWS S3: The bucket you are attempting to access must be addressed using the specified endpoint

查看:1527
本文介绍了AWS S3:您尝试访问该桶必须使用指定的端点解决的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图删除与AWS-SDK核心的Ruby宝石

I am trying to delete uploaded image files with the AWS-SDK-Core Ruby Gem

我有以下的code:

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.

我知道这个地区是正确的,因为如果我将其更改为美东1,以下错误显示出来:

I know the region is correct because if I change it to 'us-east-1', the following error shows up:

The specified key does not exist.

我在做什么错在这里?

What am I doing wrong here?

推荐答案

这很可能是这个桶是在不同区域创建的,即不美西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."

这篇关于AWS S3:您尝试访问该桶必须使用指定的端点解决的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆