AWS CodeCommit from Atlassian Bitbucket and Bitbucket Pipelines for CI offloading

Jay Proulx
6 min readJun 2, 2017

Read this first: AWS CodeBuild now supports BitBucket as a Source https://aws.amazon.com/about-aws/whats-new/2017/08/aws-codebuild-now-supports-atlassian-bitbucket-cloud-as-a-source-type/

Now, you may still find some advantage in connecting Bitbucket Pipelines with AWS CodeCommit, in which case many readers have found this article helpful.

Update 2018/07/05: Bitbucket Pipelines can generate its own keys: https://blog.bitbucket.org/2017/03/21/generate-ssh-keys-bitbucket-pipelines/ Thanks Dennis B!

You might already be using Atlassian Bitbucket for repository storage, but maybe you want to offload your Continuous Integration to AWS for a variety of reasons that I’m not going to cover, this post just explains the how of it. We assume here that you have an existing Bitbucket repository that you want to sync with AWS CodeCommit, otherwise you’ll need to create one first.

tl;dr

  1. Create an IAM group that has the appropriate CodeCommit privileges
  2. Set up an IAM user that Bitbucket Pipelines will use to push the current branch that’s building
  3. Generate an SSH private and public key, add the public key to the IAM user to get an SSH key ID (which will be the CodeCommit username)
  4. Create a bitbucket-pipelines.yml build script that will use the IAM User SSH key ID and private key to push to your AWS CodeCommit…

--

--

Jay Proulx

CXM Practice Director, all things customer experience, AWS Enthusiast, dad, husband, skier, foodie, living in The Cloud