不支持您提供的授权机制.请使用 AWS4-HMAC-SHA256 [英] The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256

查看:29
本文介绍了不支持您提供的授权机制.请使用 AWS4-HMAC-SHA256的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到一个错误 AWS::S3::Errors::InvalidRequest 您提供的授权机制不受支持.当我尝试将文件上传到新法兰克福地区的 S3 存储桶时,请使用 AWS4-HMAC-SHA256..在 美国标准 地区,一切正常.

I get an error AWS::S3::Errors::InvalidRequest The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. when I try upload file to S3 bucket in new Frankfurt region. All works properly with US Standard region.

脚本:

backup_file = '/media/db-backup_for_dev/2014-10-23_02-00-07/slave_dump.sql.gz'
s3 = AWS::S3.new(
    access_key_id:     AMAZONS3['access_key_id'],
    secret_access_key: AMAZONS3['secret_access_key']
)

s3_bucket = s3.buckets['test-frankfurt']

# Folder and file name
s3_name = "database-backups-last20days/#{File.basename(File.dirname(backup_file))}_#{File.basename(backup_file)}"

file_obj = s3_bucket.objects[s3_name]
file_obj.write(file: backup_file)

aws-sdk (1.56.0)

aws-sdk (1.56.0)

如何解决?

谢谢.

推荐答案

AWS4-HMAC-SHA256,也称为 Signature Version 4,(V4")是 S3 支持的两种身份验证方案之一.

AWS4-HMAC-SHA256, also known as Signature Version 4, ("V4") is one of two authentication schemes supported by S3.

所有地区都支持 V4,但美国标准¹;以及许多(但不是全部)其他地区也支持另一个较旧的方案,即签名版本 2(V2").

All regions support V4, but US-Standard¹, and many -- but not all -- other regions, also support the other, older scheme, Signature Version 2 ("V2").

根据 http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html ... 2014 年 1 月之后部署的新 S3 区域将仅支持 V4.

According to http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html ... new S3 regions deployed after January, 2014 will only support V4.

由于法兰克福是在 2014 年末推出的,它不支持 V2,这就是此错误表明您正在使用的内容.

Since Frankfurt was introduced late in 2014, it does not support V2, which is what this error suggests you are using.

http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html 解释了如何在各种 SDK 中启用 V4,假设您使用的是具有该功能的 SDK.

http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html explains how to enable V4 in the various SDKs, assuming you are using an SDK that has that capability.

我推测某些较旧版本的 SDK 可能不支持此选项,因此如果上述方法不起作用,您可能需要更新您正在使用的 SDK 版本.

I would speculate that some older versions of the SDKs might not support this option, so if the above doesn't help, you may need a newer release of the SDK you are using.

¹US Standard 是基于 us-east-1 区域的 S3 区域部署的旧称.从最初写这个答案的时间开始,"Amazon S3 将美国标准区域重命名为美国东部(弗吉尼亚北部)区域与 AWS 区域命名约定保持一致." 出于所有实际目的,这只是命名的更改.

¹US Standard is the former name for the S3 regional deployment that is based in the us-east-1 region. Since the time this answer was originally written, "Amazon S3 renamed the US Standard Region to the US East (N. Virginia) Region to be consistent with AWS regional naming conventions." For all practical purposes, it's only a change in naming.

这篇关于不支持您提供的授权机制.请使用 AWS4-HMAC-SHA256的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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