How Do You Troubleshoot the AWS CLI Message “An error occurred (AccessDeniedException) when calling the ListClusters operation”?

Problem scenario
You run this command aws eks list-clusters, but you get this message:

"An error occurred (AccessDeniedException) when calling the ListClusters operation: User: arn:aws:iam::12345678910:user/jdoe is not authorized to perform: eks:ListClusters on resource: arn:aws:eks:us-west-1:12345678910:cluster/*"

What should you do?

1. Go to the AWS Console and log in.
2. Go to IAM -> Users
3. Click on the user's account.
4. Click on "Add Inline Policy"
5. Click on the JSON tab
Add this content:

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "ekscontintadmin",
            "Effect": "Allow",
            "Action": "eks:*",
            "Resource": "*"

6. Click "Review policy"
7. Give a name to it
8. Click "Save policy". Adding an inline policy to a role in AWS IAM can take 10 minutes to take effect. (It is not like Security Groups.)

Leave a comment

Your email address will not be published. Required fields are marked *