CodeBuild needs a service role created which will allow it to interact with other AWS Services. You’ll need to make sure you have assigned sufficient policies to the roles to do so. Have a look through here:
https://docs.aws.amazon.com/en_pv/codebuild/latest/userguide/setting-up.html#setting-up-service-role