AWS Lambda for CodeCommit repo sync

While I haven't tried this, I suspect the following workflow could work. The general idea would be to use the BitBucket webhooks feature to trigger the lambda function through the use of API gateway.

  1. Write a Lambda function which 'mirror' clones from your bitbucket repository url and pushes to your CodeCommit repository url. Your function would likely need to include its own standalone git client library.

  2. Create an API using API gateway which calls your lambda function. Potential challenges here might be verifying that POST requests going to your API are coming from Bitbucket, and not some other source.

  3. Create a new webhook for your Bitbucket repository with the URL being the url of your API you created in step 2. A 'Repository push' trigger would be sufficient to trigger a replication event after each push.