pythonmongodbamazon-web-servicespymongoboto3

How to resolve the "botocore.exceptions.ClientError: An error occurred (AccessDenied)" error?


When I try to generate the credential report, this error pops out

botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the GenerateCredentialReport operation: User: arn:aws:iam::111111111111:user/freshers is not authorized to perform: iam:GenerateCredentialReport on resource: *

How can I fix/resolve this issue?


Solution

  • Based on the comments.

    The solution was to add missing permission iam:GenerateCredentialReport to the IAM user or role which is used to execute the boto3 script.

    {
        "Version": "2012-10-17",
        "Statement":
        {
            "Effect": "Allow",
            "Action":
            [
                "iam:GenerateCredentialReport",
                "iam:GetCredentialReport"
            ],
            "Resource": "*"
        }
    }