I'm attempting to create an eks cluster through the aws cli with the following commands:
aws eks create-cluster --name ekCsluster --role-arn arn:aws:iam::111111111111:role/eksServiceRole --resources-vpc-config subnetIds=subnet-1,subnet-2,subnet-3,subnet-4,subnet-5,subnet-6,securityGroupIds=sg-1
And get the following error:
An error occurred (AccessDeniedException) when calling the CreateCluster operation: User: arn:aws:iam::111111111111:user/userName is not authorized to perform: iam:PassRole on resource: arn:aws:iam::111111111111:role/eksServiceRole
However, I've created a permission policy, AssumeEksServiceRole
and attached it directly to the user, arn:aws:iam::111111111111:user/userName
:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:GetRole",
"iam:PassRole"
],
"Resource": "arn:aws:iam::111111111111:role/eksServiceRole"
}
]
}
In the eksServiceRole
role, I've defined the trust relationship as follows:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "eks.amazonaws.com"
},
"Action": "sts:AssumeRole"
},
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111111111111:user/userName"
},
"Action": "sts:AssumeRole"
}
]
}
What am I missing? How can I go about debugging this error message? Thanks for any and all help.