Hello guys and welcome to this tutorial in which I will be guiding you through the creation of a complete CI / CD Pipeline governed by Jenkins with all the infrastructure on AWS.

Let me first lay down a summary of what we are going to build and the different steps we’ll be taking.

GOAL

Suppose we are building / working on a Web App and we would like to implement a Continuous Integration (CI) / Continuous Deploy (CD) Pipeline to be able to develop and release working parts of the software in a more reliable and faster way in the spirit of DevOps foundations. The pipeline needs to run on a push on the remote repository (Bitbucket) and go through various steps (specified in a Jenkinsfile) in which unit / integration / load balancing tests will be run alongside some security / vulnerability scans, while saving artifacts along the way with tests’ results uploaded to an S3 bucket (for future use) and a Slack notification for immediate feedback. Artifacts will be saved in AWS Elastic Container Registry as Docker images and we would like to build all the infrastructure with Terraform, implementing our Infrastructure as Code (IaS), allowing us to programmatically define everything and treat our infrastructure (and the pipeline thanks to the use of a Jenkinsfile and the multibranch pipeline) as normal code.

BONUS

As a bonus we will also set up Jenkins completely from the user data of the AWS EC2 instance (namely from Bash at creation time). It will automatically create a jenkins admin, confirm the jenkins URL, download and install all the necessary plugins, create ssh credentials to let jenkins access Bitbucket and finally set up a multibranch pipeline which will be triggered by a push on the bitbucket repository.

CONSIDERATIONS

The pipeline we are going to create relies on a single branch. In a more mature and bigger project, you’d want to implement a Test, Staging and Production branches, to better manage all these different phases of the software development process. Still, I believe the techniques we are going to employ are the foundations for more advanced ones and with not that many modifications one could easily implement more branches in the project.

#ci-cd-pipeline #aws #jenkins #terraform #bitbucket #docker

Build a complete CI/CD Pipeline with AWS - Jenkins - Bitbucket - Docker - Terraform
4.25 GEEK