Can Codedeploy watch for CodeCommit by itself or it needs CodePipeline

1

I want to use codeDeploy to monitor for CodeCommit activities, if for example a new commit on the main branch, I want to inform EC2 that runs the current version of the app of a new change to the main branch, then from there I will pull the new changes, recompile and rerun the applications. I do wish to use CodePipeline for now. Any thoughts?

FSA
asked 8 months ago254 views
2 Answers
7

Hello,

Yes, the best way to go about this will be to use CodePipeline. I would recommend reading this blog post, which discusses how through the use of CloudWatch Events, on how to trigger your CodePipeline to execute whenever there is a reference created or updated in your CodeCommit repository.

It also mentions some best practices when going about this such as having a manual approval action in your CodePipeline, how to avoid the pipeline from triggering when editing certain files (readme.md, .gitignore, etc), and other custom logic that can help verify if the pipeline should be ran or not.

Hope this helps!

Mark

AWS
answered 7 months ago
3

Hi,

What would be the purpose of "informing" CodeDeploy about a change in CodeCommit if new version is not rebuilt? CodeDeploy cannot make use of new source code until it's recompiled to binary artefacts. So, you're right: the right way is to build a CodePipeline. This pipeline can start automatically on commits in CodeCommit. It will produce the new artefacts and those artefacts will be loaded into CodeArtefacts, from where they can be deployed to your EC2 machines.

And you're 100% right; full automation is the only sustainable way to proceed for the long-term to raise efficiency and quality. I always seek myself to reach this full automation. At the expense of some pains sometimes to find the right setup, but I am so much better off afterwards: things work without me and I can move to something else!

This blog post may be interest to get detail about a canonical architecture to achieve what you want: https://aws.amazon.com/blogs/devops/complete-ci-cd-with-aws-codecommit-aws-codebuild-aws-codedeploy-and-aws-codepipeline/

Good luck!

Didier

profile pictureAWS
EXPERT
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions