A Minimal Viable CI/CD with Terraform and AWS CodePipeline

Previous post

Next post

A Minimal Viable CI/CD with Terraform and AWS CodePipeline

By Stojce Slavkovski Tech Insights

CI/CD (Continous Integration/Continous Deployment) plays an important role in application lifecycle management. CI/CD pipelines are repeatable, less prone to errors, and they are self-explanatory – can serve as a documentation of the deployment process.

One of the most common mistakes when setting a new development project is not building a deployment pipeline since the early stage. Even if you are just a team of one developer, it is a very good idea to focus on quality from the very start.

For this reason, in this article, we will focus on the very minimal CI/CD that can be quick and easy to set-up. In our example we will deploy from Github to an AWS account.

AWS CodePipeline is an excellent choice for CI/CD if your infrastructure is on Amazon AWS. 

Usually, CI/CD pipelines consist of the following stages:

We will take a look at one straightforward CI/CD pipeline  –  static website hosted on S3, and we will use a yarn package manager. Also, we will assume that the source code is hosted on GitHub.

We, at TyphoonX usually start Terraform IaC projects with a provider setup and variables definition:

Terraform provider definition

Variables used trough the project

Next, we need to create an AWS CodePipeline script with the following stages:

First we need to create an AWS CodeBuild project:

AWS CodeBuild script

Next we will create pipeline and use CodeBuild project that we’ve just created.

AWS CodePipeline script

Finally, to automate everything, we need to connect source control with the pipeline and trigger pipeline release on code changes/commits. In order to do so, we will create hooks that will trigger pipeline release.

Webhooks for AWS and GitHub, using random secret key:

In a more advanced setup, additional stages and configurations can be added, like: packaging and security check, integration tests, smoke tests, notifications, approvals, Pull Requests, etc.

I work on TyphoonX – a cloud-native platform that automates application lifecycle management in cloud environments, focused on AWS.

If you have any questions, feel free to send me an email on stojce.slavkovski@alite-international.com.

Share This Post

You may also like

Written by

Marin Radjenovic

Written by

Efimija Laktash

Written by

Mila Kolisheva

Written by

Krste Bozinoski

We are all about going the extra mile. We deliver not only the expected, but the wished. We work hard to understand what the challenge is, how we can help our clients fast and in depth. Our mission is to deliver the change and transform not only the business but also the way value is created.

Make it more human, more efficient, more visionary. We work closely with our partners not only to transform but to enhance the way the run their business using technology in the most efficient and inspired way

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top