Use GitHub source in AWS CodeBuild Project using AWS CloudFormation
I wanted to create an AWS CodeBuild project using AWS CloudFormation, which checks out its sources from GitHub and is triggered via GitHub Webhooks. From these sources, a Node.js application should be built using a self-created docker image stored in ECR (Elastic Container Registry).
Therefore I defined the following template:
At the first try the stack creation failed with the following error message:
No Access token found, please visit AWS CodeBuild console to connect to GitHub (Service: AWSCodeBuild; Status Code: 400; Error Code: InvalidInputException; Request ID: ab458603-6fd4-11e8-9310-ff116e0423f9)
To get rid of this error message it’s necessary to set up the AWS OAuth application to have access to your repositories.
Therefore you have to navigate to the AWS CodeBuild console, create a project and select GitHub as source provider. The project does not need to be saved, it is only important to connect to GitHub.
AWS CodeBuild GitHub
The next time I tried to deploy the CloudFormation stack, the error message did not appear and the CodeBuild project was created successfully.