- 1 Creating the Lambda Function
- 2 Adding a Trigger for your CodeCommit Repository
- 3 Price considerations
- The Lambda illustrated below can trigger POST webhooks after Git pushes to CodeCommit.
- You should already have a CodeCommit repo created before starting this guide.
Creating the Lambda Function
From the AWS Console navigate to Lambda » New function
Blueprint » Blank Function
- Skip adding a trigger for now, just click on the screen that appears.
Configure the function
- No need for encryption helpers or environment variables.
Function handler and role
- Leave policy templates empty.
- No changes necessary to Advanced settings.
Create and confirm
Adding a Trigger for your CodeCommit Repository
Triggers » [Add trigger]
Repository and webhook
- Push to existing branch is not the default option, you’ll have to change it
- Use the Custom data field for your POST URL
» Create and confirm
- Repeat the same procedure for future repositories, using the same Lambda function.
The Lambda free tier … is available to both existing and new AWS customers indefinitely. 1
This function runs on average
500ms with the free tier including
3,200,000 seconds as of this writing. So you could trigger 6 million webhooks in a given month without incurring any additional AWS costs.