reference deployment

Git Webhooks on AWS

HTTPS endpoint and code for linking your Git repository to AWS

This solution deploys an HTTPS endpoint you can use to configure a webhook to link your Git to Amazon Web Services (AWS). With a webhook in place, each time a commit is pushed, the repository is automatically retrieved, zipped, and uploaded to an Amazon Simple Storage System (Amazon S3) bucket. You can then configure AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy to use the S3 bucket as a source.

This solution was developed by AWS.


AWS Service Catalog administrators can add this architecture to their own catalog.  

  •  What you'll build
  • This solution sets up a serverless AWS Cloud environment that includes the following components:

    • An Amazon API Gateway endpoint to receive Git webhook requests and forward them to AWS Lambda.
    • An AWS Lambda function to process Git webhook requests from API Gateway and invoke an AWS CodeBuild project.
    • An AWS CodeBuild project to connect to your Git service, then retrieve, zip, and upload the latest version of your Git repository to Amazon S3.
    • An AWS Key Management Service (AWS KMS) key to encrypt/decrypt SSH (Secure Shell) keys used by CodeBuild to connect to your Git repository using SSH. The SSH key pair is generated by a Lambda-backed AWS CloudFormation custom resource when the stack is deployed.
    • Two Amazon S3 buckets: one for Git repository contents, and another for encrypted SSH keys. A Lambda-backed AWS CloudFormation custom resource deletes the contents of the S3 buckets when you delete the stack. If you need backups, copy the S3 buckets before deleting the stack.
  •  How to deploy
  • To build your Git environment with AWS, follow the instructions in the deployment guide. The deployment process includes these steps:

    1. If you don't already have an AWS account, sign up at
    2. Launch the solution. The deployment takes about 15 minutes.
    3. Configure your Git repository to set up webhooks, following the instructions from your Git service. (You must be able to connect to your Git repository over the internet.)
    4. Configure an AWS service to connect to the S3 object.
    5. Test a commit.

    Amazon may share user-deployment information with the AWS Partner that collaborated with AWS on this solution.  

  •  Costs and licenses
  • This solution deploys an AWS Key Management Service (AWS KMS) key, which incurs a monthly cost for key storage and usage. (Refer to AWS Key Management Service pricing.)

    API Gateway, Amazon S3, Lambda, and AWS CodeBuild costs vary depending on how often you commit code to the connected Git repository. (Refer to Amazon API Gateway pricing, Amazon S3 pricing, AWS Lambda pricing, and AWS CodeBuild pricing.)

    You are responsible for the cost of the AWS services and any third-party licenses used while running this solution. There is no additional cost for using the solution.

    This solution includes configuration parameters that you can customize. Some of these settings, such as instance type, affect the cost of deployment. For cost estimates, refer to the pricing pages for each AWS service you use. Prices are subject to change.

    Tip: After you deploy a solution, create AWS Cost and Usage Reports to track associated costs. These reports deliver billing metrics to an Amazon Simple Storage Service (Amazon S3) bucket in your account. They provide cost estimates based on usage throughout each month and aggregate the data at the end of the month. For more information, refer to What are AWS Cost and Usage Reports?