hi hello everyone welcome to my channel this is Vijay gri and in this particular video we are going to deploy a zato clone on AWS using genin C CD and doer and terraform on AWS and this is a devops project and in this particular project I'm using some of the tools like jkin Docker terraform Java sonar Cube W and aqua and using these tools I'm deploying this zato clone and in this project using terraform I'm going to provis E instance and security groups and using e to user data I'm automatically installing Jin Java and sonar cube in E2 instance and this is our project structure first we need to create AWS access keys and secret keys and we need to give to our local Machine by using AWS configure and using terraform we are going to create automatically E2 instance and security groups and using E2 user data I can automatically create genin Java and sonor cube in easy to instance and when it comes to GitHub GitHub is used to store our source code of our Z project and when it comes to sonar Cube sonar cube is used for continuous inspection of code quality to perform automatic reviews with static analysis of code to DET bus and quot smells and when it comes to npm npm is used to install all the dependencies because this is a rejs project and when it comes to Aqua Aqua is used to scan our GitHub repository and here Aqua is a security tool that's why called it as devops and when it comes to O OS will scan our project and it will generate a report and when it comes to Docker and in this stage Docker will build Docker image and it will tag the docker image and it will push the docker image to the docker Hub and again Aqua will scan the docker image for any security issues and at last our zto app will be deployed into Docker container and this is our this is about our project guys and let's start our project for this first we need to enter into AWS Management console and we need to create AWS access keys and secret Keys let's create AWS access keys and secret keys is security credentials and you need to create here access Kee and secret case command line interface and you need to check mark this and next create access keys and you need to copy paste this and you need to come for our CMD and here you need to search for AWS configure you need to give access key and you need to give secret key this is our secret key and you can give here and I will show you in which region you want to create infra so I'm creating infra in AP South one in Mumbai region I will show so you can see here I'm creating in AP South 1 Mumbai so I'm giving AP South 1 here AP sou one okay let's see AWS S3 LS so I don't have any buckets but I'm doing this okay no problem now let's go to our GitHub and this is my GitHub account and uh here you can see terraform E2 and using this repository I'm automatically creating everything like genkins and sonor Cube and Java and uh first I will for this and I will explain this repository get clone and you need to give the repository URL and it will download to our local and using V code I'm going to create using vs code and terraform I'm going to create everything and you need to come to here and users BJ and this is that file and I will explain you this and uh in main.tf file contains the resource information which you want to create and you can see the first resource I'm creating a security groups and with inbound rules of 22 80 443 8080 9,000 and 3,000 when comes to 22 it is for SSH 80 it's for hddp and 440 is for hdps 880 it's for our genkins and 9,000 is for son Cube and 3,000 is for our zato clone because I'm giving the port of container is 3,000 so this is the Ingress and this is the ESS means outbound rules and when it comes to this resource this resource is used to create E2 instance so here I'm taking T2 large and T2 large this is the key pair and I will show you the key pair you need to go to ec2 and you need to go for here key Pairs and first here you need to create a key pair with any of the name let's wait for some time it was loading so here you can see the key pair Mumbai so you should give that key pair here Mumbai same like this okay and you can see user data in user data I was having a file install genkins Dosh you can see this is the file in this file I will explain you everything and uh this is the code to create up to here this is the code to create Jenkins and this is a code to create Docker and this is the command to run do sonar Cube container in Docker and this is the commands to install Tri in our easy to instance okay let's uh run this teral run at to file let's clear this and you can see here we need to go to this directory terraform E2 CD terraform E2 and you can do LS and you can see these are the three files and let's first do terraform init this will install all the plugins for terraform and it takes few seconds and you can see terraform unit has been completed let's do plan terraform plan and it will show the resource information which we creating right now let's see the resource information and you can see here all the security groups and E2 instance which we are creating it will show each and everything and let's apply paraform apply hyph iph Auto IO and this will and this command will create infra in AWS cloud and let's see you can see creating let's come here let's go to E2 instance and let's reload this you can see it is in pending State genkins hyphens h I will show you the name you can see here in main.tf file you can see the name Jenkins honor for our e instance it is still in creating State and it takes nearly 30 seconds to 1 minute to create let's wait for for the time and you can see it is in running State and when you come here it was also completed okay then let's come here and let's connect to our genkins the genkin port is 8080 so you need to give like this and the sonar Cube Port is 9,000 and it takes nearly 2 seconds to come to running State let's wait for that time because you can see here it is in instaling state you can you have to see here 2 by two check pass then only J kinson honor Cube will run until then we we should wait let's wait for some time you can see Jenkins is running let's wait for some time and before let's connect to our virtual machine using SSH connections let's copy the public IP session SSH you need to give the public IP here and open to then you need to give the path of our key then first we need to update our in instance by using sudo AP update now it will update and after that you need to come to root so sudu sudu and let's come here to jins you can see it was ask asking password so you need to copy this copy and you need to come here and you need to do sud sudo care and you need to paste that and it will display password and this is the password of Jin and copy this and come here and paste it here continue never install suggested plugins and it will install some of the plugins it takes nearly two to three minutes to install all these plugins and let's come to sonar Cube and let's reload this you can see sonar cube is also running and it takes nearly 30 seconds to 1 minute to start sonar Cube and let's come to ec2 and let's reload this you can see it is in installation state but it will come to 2 by2 check pass let's see and here you can see 2 by2 check pass and you can let's come to son this also running so initial username and password is admin for sonar Cube and admin and login never then you need to give the old password and here you should give the new password and giving VJ and update and this is the user interface of sonar Cube and let's go into genkins and you can see still it's installing some of the plugins and let's wait for another one minute to install all these plugins and after complet completing this we need to install some of the plugins in genkins to integrate with sonor cube with genkins and other tools like nodejs and uh uh Eclipse like Java and depend we need to install all these plugins to integrate with genkins let's wait let's do this all you can see installation has been completed all the plugins I'm giving the name like PJ password also VJ confirm password VJ full name is VJ and email VJ theof gmail.com save and continue save and finish you can see Jenkins is ready start using Jenkins and this is the user interface of Jenkins and you need to come to manage genkins to install some of the plugins you need to go to plugins and here you should search for available plugins and here you need to select first Eclipse terine installer this is the Java plugin and you need to search for sonar Cube you can see sonar Cube scanner and you need to search for nodejs nodejs Okay and we need to search for o dependency is this is also okay and let's sech for Docker you need to select Docker Docker commas Docker pipeline Docker API Docker build step and these are the plugins we need to install for this project let's install then it takes few seconds to install you can see installation also completed let's go to manage genkins and here to integrate this tools you need to go to tools let's go to tools and you can see here these are the tools and you need to select jdk and the name I'm giving like jdk 17 and you need to select install automatically add installer install from adm. net and you should search your version 17th 17.0.0 1+1 you need to select this version and you need to search for sonor cube scanner installations yes this is and I'm giving your name like sonar I scanner and you can use the latest version okay and let's search for nodejs insation this is the node translation I'm giving the name like node 16 and you need to search vers like 16.20 you can see here 16. 2.0 you need to select this and you need search for o dependency check installation this is the OS plugin and you need to select this and I'm giving the name like DP hyphen check you can give any name not only this so I'm giving DP check and you need to select install automatically add installer install from gab.com you should select this install from github.com and dependency version like I'm selecting 6 5.1 let's see this 6.5.1 this is the version dependence sck version and at last Docker add Docker and I'm giving the name like Docker and install automatically add installer install from doer. you need to select this okay and version is the latest version okay apply and let's save this okay and this is about the tools and in order to integrate sonar cube with genkins we need to generate sonar Cube token and we need to give in genkins okay first let's generate sonar token you need to go to Administration security users you have to select this under tokens you need to select this and I'm giving the name like [Music] Jenkins and you need to generate this you need to copy the copy paste this and you need to come to Jenkins again in genins you need to go to credentials and add Global add credentials and here you should search for secret file not secret file secret text and okay you need to paste that uh sorry URL to here secret text to here I'm giving the name like son token because this is son token I'm ging the name like sonar token description also sonar token okay let's create this and this is completed and we need to add a quality Gateway so you need to go to again sonar Cube and done then you need to select uh Administration again in under configuration you need to select web Hooks and create and here also I'm giving the name like Jenkins and here you should give the Jenkins IP let's do this copy the Jenkins IP up to 8080 and copy and come to here sonar Cube and paste it here and and at last you need to give sonar Cube hyphen web hook okay same same like this you should do otherwise it will throw an error let's create this and now we need to go to Jenkins and we need to integrate sonar cube with Jenkins and let's do this you need to go to again manage genkins and here you need to go for systems system and you need to search for sonor servers here you can see sonor servers you can see sonar Cube servers and under sonar Cube installations you need to select add sonar Cube and here I'm giving name like uh sonor server sonar hyen server okay then you should give the Jenkins sorry Cube for IP here so let's copy this up to 9,000 copy and you need to VI here and at last you need to remove slash and okay and you should to select this and you need to select sonar token previously we created a sonar token and we have given in genin you need to select the sonar token and this is all about this and you need to apply and let's save this and let's open our Docker Hub and here you should give the docker dockerhub credentials to Jenkins and let's give doer Hub credentials to Jenkins let's go to Jenkins and uh need to select manage genkins under you need to search for credentials and then here you should give the credentials of our dockerhub so you should select kind as username and password and username Vijay gorri is my dockerhub username and you should give the password this is my uh GI doger Hub password and then giving the name like ID Docker and description also Docker and let's create this and this is all about this and you need to come to again dashboard and you need to create a zato pipeline so pipeline I'm selecting the name like zomato you need to select the pipeline here and okay and select this discard old bills and number of bills is three r two is enough and you need to write Pipeline and previously have created a pipeline and I will use that pipeline to come to dashboard desktop then zato Pipeline and this is the pipeline which I have been created previously and I will I will use this pipeline copy this pipeline copy and you need to come to Jenkins let's past it here and I will explain you all the PIP plan I will explain this pipel and okay let's expand this and you can see this is the pipeline which I'm using for this project and you can see Pipeline and agent a any is common under Tools I'm using the previously installed jdk nodejs installations plins so these are the names which I have given and let's see this in pipeline syntax and you can see here jdk nodejs installations and Let's do let's see this and here you need to search for tools tool and you need to select this use a tool from predefined Tool installations and you need to select tool type I need jdk jdk and I'm using the tool name as jdk 17 previously I have installed this plugin and I given the name like jdk 17 and you need to select this generate pipeline script and you can see the tool name like jdk 17 which I have given name and type jdk and when you come here and when you see and uh here you can see uh to name as jdk and uh sorry to name like jdk 17 tool is jdk and let's let's see nodejs and you need to select here nodejs and this is the name which have been given previously and generate pipeline script and you can see tool name is node node 16 and type as nodejs let's you can see DM is a nodejs and it is node 16 and this is the sonar Cube envirment to scan sonar Cube and this is the stage to clean the work space and you can see this is the G checkout stage and in this stage you need to give the gab repository that means zato repository let's apply this and let's come to GitHub and let's go to repositories and you can see here zomato clone this is the repository which I'm using and you need to copy uh repository URL you need to copy this and again you need to come to pipeline syntax so this is the pipeline syntax and here you need to search for git this is the git and you need to page the repository URL and the branch of this is main so you need to give Main and generate and it will generate this and you need to copy this copy and you need to come to genkins and you need to paste it here okay guys and here you can see the sonor cube analysis and here sonor Cube is used for continuous integration of code to inspect quality to perform automatic reviews with static analysis of code to D B and cod smells continuously that means it will scan all the that means it will scan the GitHub repository and it will show you any of the quot smells and the vulnerabilities and everything I will show you that also and this is the quality Gateway which we have created previously by using Sonar Cube and this is a quality gate vage and when comes to this stage it will install npm dependencies for our project because this is a rejs project and this stage is O file scan because P scan all all the GitHub repository and it is hard to generate okay guys and when it comes to Tri Tri will scan the GitHub repository and it will display the vulnerabilities and cities like low medium critical high and it will store all that in all that report to PR fs. txt file and when it comes to dis this is Docker build and push previously I said it first it will build the docker image sorry pre it will build the zomato image and it will tag the zomato image and it will push to push to Docker Hub and when comes to this Tri R will scan the docker image again and last Docker container will be created in the docker container our Z app will be deployed and let's run this apply save and let's build now and this build takes nearly 20 minutes to complete and let's wait for that time and I will show you parall each and every output of this project and you can see the output here can see the output here you can see three stage has been completed get checkout is completed now sonor Cube analysis is going on and let's see you can see sonar cube is also completed let's go to sonar Cube and this is the sonar Cube and let's reload this let's come to project you can see the project is zato and let's enter into zato first I will show you how it you can see here lines it scanned 1.3 3K lines and these are 0.0% duplicates and you can see the Cod smells and hotpots and vulnerabilities and bugs you can see each and everything report in sonar Cube and when it comes to issues the these are the issues which it is seen in our project and when it comes to projects you can see this is the project report okay again let's go to genkins and you can see quality Gateway completed npm dependenc also has been installed and you can see over file test it takes approximately 15 to 20 minutes to complete this test and let's wait for that time and parall I will show you the report let's wait this is output console of our genkins here o scan is going on and it takes nearly 20 minutes to complete let's wait for that time and here I will keep time lapse and I will forward this no problem let's go to pipeline is not working and you can see 2 minutes approximately takes 15 to 20 minutes to complete let's wait for that time and you can see over scan is completed and it takes nearly 13 minutes to complete and tri file scan is going on and you can see preview file scan has been completed and here you can see the console output it was pulling to the docker Hub I will show you one thing here here you can see there is no zomato image and within few seconds you can see here zomato image here you can see there is no zomato image within few seconds I will show you zato image let's see output and here you can see the docker image has been building here let's wait for some time and this stage takes nearly 3 to 5 minutes to complete this stage let's write let's go to output and let's come down and let's wait for some time it was creating Docker image and here you can see it was waiting to push to dockerhub and it was saying like push and let's come here and let's reload this let's see whether it is pushed or not let's wait for some time the say like pushed to the docker hub and you can see it was also push it to dockerhub let's open dockerhub what [Music] happen let's open dockerhub doger Hub let's log to doger HUB prev file scan is going on not file scan here it was build Docker image and review scanning the docker image let's come here you can see deploy to container has been completed let's see logs it was all completed and let's see let's enter into dockerhub and you can see here the image has been pushed to dockerhub in 2 minutes ago let's come to Jenkins again and you can see this is the pipeline which we which we have been created and let's see the output and this is all the output console output for our Jenkins Pipeline and you can see the success message here and this is the container ID and let's see the container ID so Docker Docker PS hyen is the command to list all the containers which it's been running you can see this is the sonor cube container which we have been created previously and this is the zato which we created right now using Jenkins pipeline see V g/ doer and to access this you need to uh the port number of this container is 3,000 so you need to access with ec2 public IP and port ,000 so let's come here and go for E2 and copy paste the IP and come here and past it here IP and with Port 3,000 3,000 is our container port and I will open this and you can see the zomato Clone here it will display now and you can see the Z app this is the final output of our project and this is all about the project guys you can see this is the output of our project I have deployed by using genkin CD and if you want to terminate this all everything and sonar Cube and genin CD and each and everything first you need to terminate this E2 instance okay guys first you need to terminate this simply select this and you need to terminate this and I will show you the final output this is the final output and uh yes this is the output and and I will terminate this simply select this let's come to Jenkins once and let's go to zomato first I'll show you some of the dependencies over dependencies I will show you sorry here you can see the final output and here you can see sonar Cube quality Gateway and here you can see latest uh dependency check this is the OV and I will open this and I will show you the report and it will generate a report for our project here OS is nothing but it is also a security tool and in future I will made I will make a dedicated video o and aqua PR and let's see the output and here you can see dependency check results and these are all the results of our project it was generated by using o dependency check and it was generated more P let's see okay and this is all about this report and let's come to zato again here you can see this is our PIP plan and it takes approximately 15 minutes to 20 minutes to complete and okay and this is our final project final output sorry this is the final output of our project tomato and okay let's terminate this all simply come to ec2 instance and select this and uh instance State and terminate this instance and terminate okay guys this is all about this project and I hope you will like this project and uh you can see the project source code in my GitHub and if you like my video please do like share and subscribe guys and bye