This is an example serverless project for triggering CodeBuild on CodeCommit pushes. For some reason there is no trigger for that in AWS.
-
Install requirements:
npm install -g serverless npm install serverless-python-requirements
-
Copy serverless.template.yml into serverless.yml
Fill in the custom variables at the top.
- project and projectArn refer to the CodeBuild project
- repoArn refers to the CodeCommit repository from which to build
Those should already exist. This only generates a lambda and the triggers.
-
Run
serverless deploy
.After that any commit to the CodeCommit repository will start a CodeBuild.
If you only want to act on a single branch (e.g. master), you can set it in custom variables.