amazon-web-servicesgithubaws-codebuilddeploy-keys

AWS CodeBuild GitHub Deploy Keys


With AWS CodeBuild you define GitHub as the source. If your repo is private, you can pass a personal token. I've built a CodeBuild process and confirmed this worked.

What I'd like to do is not use a personal token, instead use a GitHub Deploy Key to authenticate to the private repo. I've setup the Deploy Key in GitHub. How do I configure this either in the AWS CodeBuild Console or in the YAML script?


Solution

  • CodeBuild doesn't natively support deploy keys. It is on our product backlog and is a feature that we will likely support in a future release.

    In order to use your existing deploy key in CodeBuild, please follow the instruction that Adrian has highlighted in https://adrianhesketh.com/2018/05/02/go-private-repositories-and-aws-codebuild/. You will need to setup the key in parameter-store and use that in your buildspec.

    You can use the source type as "no_source", since you would be doing the source cloning with the deploy key in this case.