A Cloud Architect Company
Amazon Web Services

how to setup jenkins CI/CD pipeline to automate build and deployment for ECS

INTRODUCTION:

In this article we are going to setup jenkins CI/CD pipeline to automate build and deployment for ECS, –Jenkins is an open-source automation server widely used for building, testing, and deploying software projects. It allows developers to automate various parts of the software development process, including building code, running tests, and deploying applications. Jenkins can be integrated with version control systems like Git, enabling automatic triggering of builds whenever new code is committed.

If you would like to follow a video tutorial please use our YouTube video.

WHAT IS ECS:

ECS is a fully managed container orchestration service provided by Amazon Web Services. It enables you to run, stop, and manage Docker containers on a cluster of virtual machines that are managed by AWS. ECS simplifies the process of deploying, managing, and scaling containerized applications.

WHAT IS ECR:

ECR is a fully managed Docker container registry service provided by Amazon Web Services. It allows you to store, manage, and deploy Docker container images securely. ECR is tightly integrated with other AWS services, particularly Amazon ECS and Amazon Elastic Kubernetes Service, making it easy to deploy containerized applications on AWS infrastructure.

PREREQUISITES:

  • AWS account.
  • AWS account with ecr and ecs full access.
  • Basic knowledge about Jenkins.

INTENDED AUDIENCE:

  • Engineer

JENKINS-INSTALLING PLUGINS:

Go inside jenkins

Jenkins dashboard

Click on manage jenkins > plugins > Available plugins

Install the plugins shown below

installing plugins

ADDING WEBHOOKS:

Go to the Reactjs soure code in Bitbucket > click on Repository settings

Repository settings

Click on Webhooks > give a name to webhook > paste the url of the jenkins in the url section > click on generate secret > create webhook

Adding webhooks

CREATING NEW ITEM:

Now go to the jenkins server > click on new item > select pipeline > click ok

Adding new Item

In general settings enable Github projects and paste the repository url where we have the source code of react js

Enable github project

In build trigger enable build when a change is pushed to bitbucket and paste the repository url

Build Triggers

Enable poll scm and enter five asterisk symbol 

Poll SCM

In pipeline definition select pipeline script from scm > In scm select Git > paste the repository link

add the credentials that is user name and password of the bitbucket

Pipeline configuration

Finally add the script path > apply and save

Applly and save

BUILDING AND DEPLOYING THE APPLICATION USING PIPELINES:

Go back to jenkins server and click on Build now

build now

our pipeline is running and ecs is successfully deployed.

Now go to the ecs console > go inside the cluster you created > go inside task and copy the public ip.

copy task public ip

Now search the public ip.

React js app

React app is successfully running.

Now change the source code and see whether the pipeline is automatically running

click on commit

Changing source code

ECS Deployment

You can see that the pipeline got triggered automatically and deployed ECS

Now go to the ecs console > go inside the cluster we created > go inside the newly created task > copy the public ip

Copy task public ip

Now search the public ip > react js is successfully running

React js app

The content is changed automatically when we changed the source code.

The pipeline got auto triggered and changed the content.

 

DO YOU HAVE ANY QUESTIONS?

Should you require help in performing the Jenkins pipeline steps, feel free to contact at our email id [email protected]

Website – www.easydeploy.io/contact-us

Leave a Reply

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

back to top
advanced-floating-content-close-btn

Contact Us to save your AWS bill by 40%

X