ERROR An error occurred (AccessDenied) when calling the DeleteObject operation: Access Denied

0

my s3 IAM

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:*",
                "s3-object-lambda:*"
            ],
            "Resource": "*"
        }
    ]
}

settings.py

INSTALLED_APPS = [
    'storages',
]

DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"

django code

def UpdateCompanyView(request):
    user = request.user
    company = user.company
    old_logo = company.logo
    if old_logo and 'logo' in serializer.validated_data and data_logo is not None:
        old_logo.delete()
    #old_logo.delete(save=False)#I've tried this also

other all actions working put, add, but deleting occurring this error

질문됨 6달 전331회 조회
1개 답변
0

Hello.

S3 bucket policy not set?
If DeleteObject is denied in the S3 bucket policy, object deletion will fail even if the IAM policy allows it.

profile picture
전문가
답변함 6달 전
  • where to set it ?

    in the bucket policy i already add the same, but same error

  • If the IAM policy is set correctly, there is no need to set the S3 bucket policy.

  • then which policy you're talking about. the IAM policy is already set. then why i'm getting this error. please give me the solution if you know about it

  • Is your AWS account managed by AWS Organizations? In that case, please check whether DeleteObject is not rejected by SCP. Additionally, please make sure that "Permissions boundaries" are not set, as described in the document below. https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html?icmpid=docs_iam_console

  • when i visit SCPs

    Your request has a problem. Please see the following details. Your account is not a member of an organization.

    and Permissions boundaries are also not set

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠