amazon-web-servicesamazon-iamroles

How do I know a function is a service role?


When adding a service role to a user for example: AccessAnalyzerServiceRolePolicy, I am getting the error:

Failed to add permissions to davidh38
Failed to add AccessAnalyzerServiceRolePolicy to user. Cannot attach a Service Role Policy to an IAM user.

How do I know a role is a service role?


Solution

  • You are not adding a role, you are adding a policy.

    According to the documentation for AccessAnalyzerServiceRolePolicy the ARN is arn:aws:iam::aws:policy/aws-service-role/AccessAnalyzerServiceRolePolicy. I don't know if it is the full list, but I would avoid any AWS-managed ARN starting with policy/aws-service-role in its name.