버킷 수준 권한으로 PutObject 작업을 호출 할 때 액세스가 거부 됨
사용자에게 하나의 버킷에 대한 액세스 권한을 부여하는 방법 은 http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_examples.html#iam-policy-example-s3 의 예제를 따랐습니다 .
그런 다음 W3 Total Cache Wordpress 플러그인을 사용하여 구성을 테스트했습니다. 테스트에 실패했습니다.
나는 또한 사용하여 문제를 재현 해 보았습니다.
aws s3 cp --acl=public-read --cache-control='max-age=604800, public' ./test.txt s3://my-bucket/
그리고 그것은 실패했습니다
upload failed: ./test.txt to s3://my-bucket/test.txt A client error (AccessDenied) occurred when calling the PutObject operation: Access Denied
내 버킷에 업로드 할 수없는 이유는 무엇입니까?
내 질문에 답하려면 :
예제 정책에서는 PutObject 액세스 권한을 부여했지만 PutObjectAcl 액세스 권한도 부여해야했습니다.
나는 변해야했다
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
예제에서 다음으로 :
"s3:PutObject",
"s3:PutObjectAcl",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:DeleteObject"
또한 다음 두 상자를 선택 취소하여 클라이언트가 공개 액세스 가능한 ACL을 설정하도록 버킷이 구성되어 있는지 확인해야합니다.
비슷한 문제가 발생했습니다. ACL 항목을 사용하지 않았기 때문에 s3:PutObjectAcl.
제 경우에는 ( 서버리스 프레임 워크 YML에서) 다음을 수행했습니다.
- Effect: Allow
Action:
- s3:PutObject
Resource: "arn:aws:s3:::MyBucketName"
대신에:
- Effect: Allow
Action:
- s3:PutObject
Resource: "arn:aws:s3:::MyBucketName/*"
/*버킷 ARN 끝에를 추가합니다 .
도움이 되었기를 바랍니다.
나는 단지 큰 파일로 작업하기 위해 S3 업로드를 얻기 위해 벽에 머리를 부딪 히고 있었다. 처음에 내 오류는 다음과 같습니다.
An error occurred (AccessDenied) when calling the CreateMultipartUpload operation: Access Denied
그런 다음 더 작은 파일을 복사 해 보았습니다.
An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
객체를 잘 나열 할 수 있지만 s3:*역할 정책에 권한 이 있어도 다른 작업을 수행 할 수 없습니다 . 나는 이것에 대한 정책을 재 작업했습니다.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": "arn:aws:s3:::my-bucket/*"
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucketMultipartUploads",
"s3:AbortMultipartUpload",
"s3:ListMultipartUploadParts"
],
"Resource": [
"arn:aws:s3:::my-bucket",
"arn:aws:s3:::my-bucket/*"
]
},
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "*"
}
]
}
이제 모든 파일을 업로드 할 수 있습니다. my-bucket버킷 이름으로 바꿉니다 . 나는 이것이 이것을 겪는 다른 누군가에게 도움이되기를 바랍니다.
In case this help out anyone else, in my case, I was using a CMK (it worked fine using the default aws/s3 key)
I had to go into my encryption key definition in IAM and add the programmatic user logged into boto3 to the list of users that "can use this key to encrypt and decrypt data from within applications and when using AWS services integrated with KMS.".
I had a similar issue uploading to an S3 bucket protected with KWS encryption. I have a minimal policy that allows the addition of objects under a specific s3 key.
I needed to add the following KMS permissions to my policy to allow the role to put objects in the bucket. (Might be slightly more than are strictly required)
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"kms:ListKeys",
"kms:GenerateRandom",
"kms:ListAliases",
"s3:PutAccountPublicAccessBlock",
"s3:GetAccountPublicAccessBlock",
"s3:ListAllMyBuckets",
"s3:HeadBucket"
],
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"kms:ImportKeyMaterial",
"kms:ListKeyPolicies",
"kms:ListRetirableGrants",
"kms:GetKeyPolicy",
"kms:GenerateDataKeyWithoutPlaintext",
"kms:ListResourceTags",
"kms:ReEncryptFrom",
"kms:ListGrants",
"kms:GetParametersForImport",
"kms:TagResource",
"kms:Encrypt",
"kms:GetKeyRotationStatus",
"kms:GenerateDataKey",
"kms:ReEncryptTo",
"kms:DescribeKey"
],
"Resource": "arn:aws:kms:<MY-REGION>:<MY-ACCOUNT>:key/<MY-KEY-GUID>"
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": [
<The S3 actions>
],
"Resource": [
"arn:aws:s3:::<MY-BUCKET-NAME>",
"arn:aws:s3:::<MY-BUCKET-NAME>/<MY-BUCKET-KEY>/*"
]
}
]
}
I was having the same error message for a mistake I made: Make sure you use a correct s3 uri such as: s3://my-bucket-name/
(If my-bucket-name is at the root of your aws s3 obviously)
브라우저에서 s3 버킷을 복사하여 붙여 넣으면 다음과 같은 결과를 얻을 수 있기 때문입니다. https://s3.console.aws.amazon.com/s3/buckets/my-bucket-name/?region=my-aws-regiontab=overview
따라서 나는 다음을 발생시키는 실수를했습니다 s3://buckets/my-bucket-name.
An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
'Nice programing' 카테고리의 다른 글
| SublimeText 3에서 키보드로 열 / 수직 선택 (0) | 2020.11.19 |
|---|---|
| Laravel 5.1에서 Gmail을 사용하여 메일을 보내는 방법은 무엇입니까? (0) | 2020.11.19 |
| 입력 한 숫자가 jquery의 숫자인지 확인 (0) | 2020.11.19 |
| 가장 가까운 5로 반올림 (0) | 2020.11.19 |
| 패턴과 일치하거나 빈 문자열 인 정규식 (0) | 2020.11.19 |
