Problem Statement –
Setup a CI/CD pipeline using the tools your choice(or preferably the mentioned tools).
It should deploy a simple web application to a server on a code push to a
The deployed web application should be reachable on any web browser.
Make it scalable such that when load increases the number of servers scale
up and down making sure the new servers have the updated code.
Setup to be done using AWS, Jenkins, CodeDeploy
Jenkins should not be on the same server as the application being
Tools 1. Jenkins 2. Git/Bitbucket 3. AWS EC2 4. AWS CodeDeploy
In first provide AmazonEC2RoleforAWSCodeDeploy and AmazonS3FullAccess
In second provide codedeplyrole role.
This roles will be used further.
User data i have used -
sudo yum -y update
sudo yum -y install ruby
sudo yum -y install wget
sudo chmod +x ./install
sudo ./install auto
sudo yum install -y python-pip
sudo pip install awscli
- This user data includes installation of some software like aws codedeploy , aws cli etc.
- add first IAM role to the instances .
- Create Security Group and provide http 80 and ssh 22 rules.
- Than create instances.
Step 3 - Create an of any of the instance which we
will use in AutoScalingGroup.
Step 4 - Create Application Load Balancer.
- Create target group than load balancer , in target group give path to /index.html , which is the app file containing code over git.
Now Create Application Load Balancer -
We have added the targets to already created instances.
Step 6 - Create one Jenkins Instance and install
jenkins software in it.
I have used the below link to install JENKINS server into the ec2
NOTE - i have also installed git in it , using Command -
- yum install git -y
Step 7 - Create CodeDeploy
Deployment Group Is Created.
Now we will use Jenkins for Creating a pipeline that will use git as a
source and will run the CodeDeploy.
Step 8 - Create an S3 bucket.
Step 9 - Go to Jenkins Server
- Install AWS Code Deploy plugin in it
Here we can see , it take time , as we have choosed the option of
build all at once.
Step 11 -
Go to AWS Load balancer portal and go to that
particular ELB you have Created and copy the DNS and
paste it on browser , your application will be running .
This is the first version of application. Now if i made any change to
the code it will automatically reflect to the Web browser within some
And here is the Our Final Output .
We can see that it shows the recent changed done by us in the html
Since we have used Auto Scaling Group and using ELB and its url
to access the application , we can confirm that it scalable such that
when load increases the number of servers scale up and down
making sure the new servers have the updated code.
Pardon me if I missed any step in between.