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
Click on manage jenkins > plugins > Available plugins
Install the plugins shown below
ADDING WEBHOOKS:
Go to the Reactjs soure code in Bitbucket > click on 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
CREATING NEW ITEM:
Now go to the jenkins server > click on new item > select pipeline > click ok
In general settings enable Github projects and paste the repository url where we have the source code of react js
In build trigger enable build when a change is pushed to bitbucket and paste the repository url
Enable poll scm and enter five asterisk symbol
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
Finally add the script path > apply and save
BUILDING AND DEPLOYING THE APPLICATION USING PIPELINES:
Go back to jenkins server and click on 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.
Now search the public ip.
React app is successfully running.
Now change the source code and see whether the pipeline is automatically running
click on commit
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
Now search the public ip > react js is successfully running
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