AWS – The policy is attached to 0 entities

While updating the codeBuild image version in AWS getting the error as “the policy is attached to 0 entities but it must be attached to a single role”.

aws 0 entities error

Error:

The policy is attached to 0 entities but it must be attached to a single role.

Details:

This error occurs due to the checkbox selected as “Allow AWS codeBuild to modify this service role so it can be used with the build project”. and the generated policy is not attached to the service role.

Whenever we select the checkbox “Allow AWS codeBuild to modify this service role so it can be used with the build project”, CodeBuild creates a policy with format “CodeBuildBasePolicy-project-name-region”. and if policy is already created with the previous builds, it must be attached to the service role of that codeBuild.

Solution:

Attach the policy as "CodeBuildBasePolicy-project-name-region" for the service role of the codeBuild.

Follow the below steps to attach the policy:

  1. Open IAM.
  2. Go to Roles.
  3. Search the role which is attached with the codeBuild.
  4. Search the existing policy.
  5. Add the policy to the role.

Leave a Reply

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

Back To Top