Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services PutObject操作:身份提供程序拒绝访问_Amazon Web Services_Amazon S3_Oauth_Amazon Iam - Fatal编程技术网

Amazon web services PutObject操作:身份提供程序拒绝访问

Amazon web services PutObject操作:身份提供程序拒绝访问,amazon-web-services,amazon-s3,oauth,amazon-iam,Amazon Web Services,Amazon S3,Oauth,Amazon Iam,我在AWS中使用一个身份提供者,该提供者能够向他管理的用户授予具有以下策略的角色 { "Version": "2012-10-17", "Statement": [ { "Sid": "GiveS3Access", "Effect": "Allow", &

我在AWS中使用一个身份提供者,该提供者能够向他管理的用户授予具有以下策略的角色

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "GiveS3Access",
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": "arn:aws:s3:::mybucket"
        }
    ]
}
在我的计算机上有一个有效的访问令牌,我可以列出s3存储桶中的对象(下面的例子),但我不能在上面推送任何对象

❯ aws s3 ls s3://mybucket/
                           PRE test_folder/
                           PRE home/
2020-10-07 15:22:13      57385 Image001.png
2020-10-07 15:25:20      98942 Image002.png

❯ aws s3 cp test.mp4 s3://mybucket/test.mp4
upload failed: ./test.mp4 to s3://mybucket/test.mp4 An error occurred (AccessDenied) when calling the PutObject operation: Access Denied

没有默认加密,也没有bucket额外策略。配置文件(
~/.aws/config
)已正确配置为使用
GiveS3Access
策略(第一个代码块)询问角色。

格式为
arn:aws:s3::mybucket
的arn仅用于bucket,而不是其对象。要启用对象的下载/上载,应具备:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "GiveS3Access",
            "Effect": "Allow",
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::mybucket",
                "arn:aws:s3:::mybucket/*"
            ]
        }
    ]
}
但是,这允许对bucket和对象执行所有操作。请重新考虑将其更改为跟随