AWS DevOps CI/CD | CI CD Setup Using CodeBuild CodePipeline ECS | ECS Fargate | CI CD Setup

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so we are going to see how to set up see a silly pipeline using a double scull pipeline and we're going to use the components github for source a double is code build to build docker images and easiest forget cluster for deploying applications to the environments Decius forget is AWS Web Services for orchestrating production grade docker workloads so he says forget will takes care of all heavy lifting and it allows us to just deploy containers into the cluster and the rest is automatically taken care first I want to create easiest cluster you forget go to next name the cluster I'm naming it Java home I don't want to create new VPC for the cluster here create it the cluster is ready the next step is to create task definition in order to run containers inside this cluster first we need to have a task definition let me go to touch definitions and hit create new task definition the launch type is forget throughout this example I am going to use easy as forget next step task definition name I have one sample note app in my github repository I want to use that this task role is optional network mode is a SS V PC for for gate kind of toss definitions the default network mode is a SS V PC and task execution I am role so I want this role to be created the task size you have to allocate that compute and memory for the task definition and I am selecting minimum values okay see that so the allocation we did here is a task definition level inside each task definitions we can have multiple containers so to repeat the allocation we made is a task definition level and that we are going to spread across multiple containers inside task definition as part of this demonstration I am going to have a task definition with only one container so ad container container name let's call that node app I want to pull this image from my easier I'm going to push images to elastic container registry and from there I want to pull and deployed into my easiest forget cluster okay so as of now I do not have any repository there so parallely let me open one more tab let's set up a repository click on repositories create repository I'm calling this node app created as of now we don't have any images when we go and set up see I see a pipeline code build will push images to this registry so copy this provide that information let me point to latest image this is not required memory soft limit a soft limit is nothing but the minimum allocation is made to the container at launch time so you also can set hard limit when you said hard limit it can allocate memory up to the hard limit if you leave it so whatever is available at toss definition level that is utilized on demand so a port mapping inside container our application is exposing 8080 let me keep it 8080 and we have other details like health check all these details are not required for this demonstration so environment CPU units so I will again choose minimum CPU units we have chosen memory limits here and the CPU usage there environment variables all that stuff not required as of now so I'm pretty much done with filling task definition for node app let's go and create that see a task definition level we have 512 nib for a memory and CPU we have 256 CP units these are the allocations I made to the container if I have one no container I can use the remaining utilization in task definition to those containers okay so right so let's go ahead and create task definition even our task definition is ready we have cluster we have task definition using service I'm going to create multiple tasks nothing but replicas and I want to add those tasks behind application load balancer such that n customers will hit a lb and LB distributes traffic across multiple replicas of your tasks before I go ahead and create a service I need lb let's go to easy to okay load balancers so create a load balancer before creating load balancer let me create a target group let's discard all of that okay so create target group Nord app so IP support number I want to have 8080 because my instances otherwise docker containers will expose 8080 and he'll sex looks fine and I want to just bring down healthy threshold so created next step is load balancer so create load balancer application load balancer name let's name this Java home app a scheme I want it to be internet facing IP address type ipv4 on which port we want load balancer to listen I want it 80 VPC default and for high availability select multiple zones so configure security settings we are not using HTTPS so this page is blank a security group let me go ahead and create ciao home lb lb is listening on 80 I would like to choose stdp anywhere now configure the routing part we have existing target group there so these details auto-populated register targets review created right to repeat the process lb listens on 80 okay and the target group will link right they listen on 80 80 given health checks when it makes health checks on easiest tasks our easiest tasks will run on 80 80 so that's why I made this 80 80 the next step is to create a service we have cluster task definition we have L before integrating the tasks with the load balancer next step is service go to clusters open your cluster create a service lunch type is forget is no tap the latest revision we have only one which is one and its latest so platform version leaving it as latest service name let's call this node app number of tasks let me put three I am living minimum healthy percentage maximum percentage all that default values so deployment strategy you can choose rolling update for this example next step so VPC I want to choose all default V PCs and for high availability I want to select more than one subnet across different zones let's edit secretary groups and let me choose custom TCP custom TCP and let me listen on 8080 so this equity group is a firewall for your tasks okay as I said tasks are listening on 8080 that's why I am opening 8080 source anywhere so save this we do need auto-assign public IP for this case hell shake grace period I am leaving it load-balancing yes I won't integrate my service with application load balancer select that load balance and name it Auto populated and so container to load balancing mapping is auto populated again so add to load balancer ok and I do not need to change anything you so fine I am fine with these things no I don't want to create a new one I want to have the existing port even target group I want a map to existing target group service discovery for this example I do not need even auto-scaling I don't want next great cluster if all goes good we should have our node.js application deployed into elastic container service behind Elbe so be of service see that at service level I said three replicas desired countess tree and three containers are coming up probably it might take a while for becoming active State this tasks going to fail for sure why because we're pointing to elastic container registry which doesn't have any images it's going to fail when it pulls images and obviously the task provisioning is also going to fail temporarily to fix this problem let me upload our node.js image to easier you go to elastic container history open that so let me see how to push images to this easier so these are the steps on Mac OS or Linux I am doing all this stuff on my Mac voice let's follow these instructions so copy best it Login succeeded the next step is to build our image let me take the code from github no DAP let me clone this get clone seed into no DAP let me start docker on my macbook we do LS darker build affinity for tagging no tap and the location of doc file so it's going to build our image so the warnings we can ignore them so alright so we successfully built image and we tagged it the next step is this one in order to push this darker image to easier we need to tag it with a prefix of the ACR followed by the image name and tag so copy this execute that I think I have used have used just no DAP all right and the final step is to push it so copy pushed image yeah the image got pushed successfully let's close this window check that so alright so we have one version with latest right now get back to ecs and refresh refresh they are in running state see there are many stocked state because earlier there was no image obviously when it tries to pull images from easier it fails and creation of task face now I see a three in running state because the image got pushed it's able to pull them and run containers I want to do one more cross-check that one is go too easy too lb and specifically we should go to task sorry target groups I see that so it created three tasks all those IP addresses are added to the target group that target group in turn is linked with a load balancer so we see all of them healthy now if I pick up DNS name and try here see that we have node application successfully deployed on ACS forget cluster now we should go ahead and set up see I see a pipeline okay now I want to have code build first in code build I want to create a new project this code build project going to pull this repository using build spec dot ml it's going to build docker image and push that to elastic container registry so I need to do update for repository URI let's edit this one I want to change let's not include tag it should just point to repository URI and okay so pre-build we are was that logging into Asia and we are preparing the details like repository URI and the commit hash is used as a tag so image tag all the stuff then we are trying to build docker image with the details configured in pre build but tagging it so in possible actions we are pushing that image to elastic container registry fine so we do have one JSON file image definition stored Jason will have discussions on this little later so I want to update my registry details that's updated and commit to change so come back to code build create build project you I'll call this node app description is optional source code I want to connect to github so it'll ask you in your case see I am already connected in your case it will ask you to connect you have to provide your github username and password then it gets connected so I want to get the repository in my github account which is node app right then yeah if you want to trigger this code built automatically whenever we push commits to github account enable this you also can choose for which even type you want to trigger this I want to trigger for a push event so environment I want to go with managed image I don't want to use any custom image there Ubuntu so run times standard image I'm fine with any of that I am leaving this image version privileged I need to enable this because we are using docker commands it requires elevated permissions for that I need to I must select this option so new service role I want to create service role for this let me call this one two three four five two to make sure it is eunuch I do not need any VPC configuration code build works based on the inputs provided with build spec file that is already included part of our repository so by default we need to keep this file in project root and file name must be build spec Tamil if we are following default naming conventions we do not need to explicitly provide these details if your file name is different and you are keeping that file in a different path then you have to provide all that information here so artifacts I would like to say no artifacts because my code bill will upload dark image to elastic container registry so I do not need to have anything in s3 so locks also leave all defaults there create build project okay there is an issue this policy already exes to fix this problem let's delete Android shy in your case it might not happen policy a policy yeah so delete probably I was trying some demonstrations offline that's causing issue for me so create build project yes here we successfully created code build project when I start build it pulls code from my github account it uses build spec dot amyl accordingly it's going to create a docker image and publish that docker image to elastic container registry so let me start the build it's going to take couple of minutes okay so these details I want to leave all defaults this is going to take couple of minutes I will pass my video once build completes I will be back right so we're back and it seems bill got failed it got failed while executing this command this is basically lack of permissions go to I am rolls you this one I think so yeah it is code build node app service roll one two three four five to this I need to add additional policies to get access to a CR attach policy Amazon ec2 container registry full access attached so go back to your code build retry that so again I'm going to pass video until the build is ready I will be back once I see the output I see the status succeeded if you scroll down the logs I see it is success to cross-check the image is pushed within open repositories in separate tab yeah see we see two images the one which we pushed manually from our localhost and the second one is created by your code build right we have cluster we have source which is github we have code build which is pulling the source code from github building images and pushing to docker elastic container registry the next step is to setup code pipeline so go to pipeline a crate pipeline named jaha map it's going to create new service role and next source provider is a github so hit on connect to github so I already logged into my github account so no tap Massa branch so how to detect the changes someone have github web hooks hit next I had to choose my build it is code build so what happens now code pipeline pulls the source code from github passes that as input to code build project name is not upright so for build stage I'm using code build region is Mumbai and the project name is node app next step is to deploy I want to deploy this application to elastic container service surname is Java home service name is no dap this is optional same next our pipeline is almost ready so create pipeline so after trading pipeline it ought to started right now it is in so staged so I'm going to pause this video until I see some output source course exceeded even bill God succeeded it's currently in deploy stage even deployment got succeeded it has taken more than five minutes for me to complete all the process so finally we automated CI CD using a double score pipeline code build and easiest forget four deployments in order to test this again let me do some change from application I will edit a file I'll change the color and commit those changes the moment I commit those changes it has to trigger the pipeline automatically so commend that see that so pipeline got a request from github about the push I'm a right now it triggered this process it goes through all the stages now source build and deploy after the code is successfully deployed when I go and access the elbe the color should change to red and the version should point to four you let me pass video because it's going to take some time to deploy stage and if you check ECS see that it has created in new revision and provisioning three new tasks which is referring to new docker image once all these tasks become healthy eventually these instances are terminated well new-build deployed successfully and let me refresh this page of course we see change in color and we do see change in version number that's what we updated part of this see ACD process and this is for all demo how to implement CA CD using code pipeline code build and easiest forked cluster you
Info
Channel: Java Home Cloud
Views: 36,375
Rating: undefined out of 5
Keywords: java home, devops, java home cloud, devops tutorial, devops by javahome, devops by java home cloud, aws, aws tutorial, aws by javahome, aws ecs, aws ecs tutorial, aws ecs fargate, aws ecs fargate tutorial, aws ecs demo, aws ecs task definition, aws ecs service, aws ecs alb integration, aws alb demo, aws docker tutorial, aws ecs docker tutorial, ci cd using codepipeline, ci cd using codebuild, ci cd using ecs fargate cluster
Id: 00qQaoC-5ig
Channel Id: undefined
Length: 33min 7sec (1987 seconds)
Published: Sat Jul 13 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.