title: Getting error "An error occurred (AccessDenied) when calling the AssumeRole operation: Access denied" after setting up EKS cluster
body: <p>I have created the EKS cluster using AWS console, while creating a cluster I used my pre-created VPCs and subnets, I have created one role <code>eks-role</code> which has <code>AmazonEKSClusterPolicy</code> and <code>AmazonEKSServicePolicy</code> attached to it.</p>
  
  <p>I have added the <code>kubeconfig</code> file using:</p>
  
  <pre><code>aws eks update-kubeconfig --name eks-cluster --role-arn "arn:aws:iam::############:role/eks-role"
  </code></pre>
  
  <p>When I use <code>kubectl get svc</code> command I get the error as:</p>
  
  <blockquote>
    <p>An error occurred (AccessDenied) when calling the AssumeRole operation: Access denied</p>
  </blockquote>
  
  <p>I don't know what might be wrong with this.</p>
  
  <hr>
  
  <p>In My user, I have added a policy as:</p>
  
  <pre><code>{
      "Version": "2012-10-17",
      "Statement": [
          {
              "Effect": "Allow",
              "Action": "sts:AssumeRole",
              "Resource": "arn:aws:iam::############:role/eks-role"
          }
      ]
  }
  </code></pre>
  
  <p>And In the role I have added the trust relationship:</p>
  
  <pre><code>{
    "Version": "2008-10-17",
    "Statement": [
      {
        "Sid": "",
        "Effect": "Allow",
        "Principal": {
          "AWS": "arn:aws:iam::############:user/test"
        },
        "Action": "sts:AssumeRole"
      }
    ]
  }
  </code></pre>
  
  <hr>
  
  <p>My <code>~/.aws/credentials</code> file looks like this:</p>
  
  <pre><code>**[default]**
  aws_access_key_id = ##############
  
  aws_secret_access_key = #############################
  
  region=us-west-1
  
  **[test]**
  aws_access_key_id = ###########
  
  aws_secret_access_key = #############################
  
  region=ap-southeast-1
  
  **[eks]**
  role_arn = arn:aws:iam::##########:role/eks-role
  
  source_profile = test
  </code></pre>