AWS S3: The bucket you are attempting to access must be addressed using the specified endpoint

后端 未结 15 418
南旧
南旧 2020-12-02 10:33

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

I have the following code:

require \'aws-sdk-core\'

def pull_picture(pict         


        
相关标签:
15条回答
  • 2020-12-02 11:15

    During the creation of S3Client you can specify the endpoint mapping to a particular region. If default of s3.amazonaws.com then bucket will be created in us-east-1 which is North Virginia.

    More details on S3 endpoints and regions in AWS docs: http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region.

    So, always make sure about the endpoint/region while creating the S3Client and access S3 resouces using the same client in the same region.

    If the bucket is created from AWS S3 Console, then check the region from the console for that bucket then create a S3 Client in that region using the endpoint details mentioned in the above link.

    0 讨论(0)
  • 2020-12-02 11:15

    In my case, I selected wrong RegionEndpoint. After selecting the correct RegionEndpoint, it started working :)

    0 讨论(0)
  • 2020-12-02 11:16

    This occurred for me when I had a source ip constraint on the policy being used by the user (access key / secret key) to create the s3 bucket. My IP was accurate--but for some reason it wouldn't work and gave this error.

    0 讨论(0)
  • 2020-12-02 11:17

    None of the above answers fixed my issue.

    The above answers are probably more likely the cause of your problem but my issue was that I was using the wrong bucket name. It was a valid bucket name, it just wasn't my bucket.

    The bucket I was pointing to was in a different region that my lambda function so check your bucket name!

    0 讨论(0)
  • 2020-12-02 11:18

    I encountered this issue when using a different AWS profile. I saw the error when I was using an account with admin permissions, so the possibility of permissions issues seemed unlikely.

    It's really a pet peeve of mine that AWS is so prone to issuing error messages that have such little correlation with the required actions, from a user perspective.

    0 讨论(0)
  • 2020-12-02 11:18

    I live in uk was keep on trying for 'us-west-2'region. So redirected to 'eu-west-2'. The correct region for S3 is 'eu-west-2'

    0 讨论(0)
提交回复
热议问题