One option is to use CodePipeline. Unfortunately with CodePipeline there is currently a weird process in making a Lambda function work as the sole process for the pipeline. Basically it comes down to:
- Make a CodePipeline with the AWS CodeCommit as your source repo
- Create one of the required Build/Deploy stages with the settings it asks for. Note that you will remove these later (unless you actually plan to use CodePipeline stages as given) so create a new CodeBuild project or something just to get through the wizard.
- Create a Lambda function that talks to BitBucket to sync your changes. The role attached must have permissions to interface with CodePipeline and CodeCommit. The Lambda function must also call either one of PubJobSuccessResult or PutJobFailureResult so that CodePipeline knows the Lambda actually did something and to not sit and wait for the function to complete.
- Now go back to the CodePipeline and edit it. For whatever stage was generated remove the existing action. Add a new Invoke action that points to the Lambda function and set the Role which gives access to CodePipeline for setting the job result and CodeCommit for reading the repo.
Another option is to use CloudWatch scheduling to invoke the Lambda at X interval if you're okay with a more delayed sync. This will probably be easier to setup in the long run, with the possibility of having null Lambda runs if there's nothing to sync, counting against your allocation.