Day-24 | TERRAFORM WITH AWS PROJECT | @cloudchamp | AWS REAL TIME PROJECT #aws

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone my name is Abhishek and welcome back to my Channel today is day 24 of free AWS devops Zero to Hero series and in this video we will learn how to use terraform to automate infrastructure or create resources on AWS in the previous videos we have seen how to create infrastructure from the AWS console we have seen how to create infrastructure using cloud formation templates we have also used AWS CLI and now it's turned for terraform I know that some of you might feel that terraform is overwhelming or there is so much to learn about terraform but if you are fundamentals or stronger if you know how to create resources from the AWS UI using terraform is very very simple and in this video I have invited Cloud champ nasimulla to join our Channel and explain about a real-time terraform project and this is going to be very very interesting this is the same thing that we have done on A7 but we have created this entire thing even more than that we have also used the private subnet and we have created all the resources from AWS infrastructure but in today's video we will learn how to use terraform okay so let's welcome Cloud champ to our channel so I'm very excited uh to have you here at cloudchamp and we are going to learn very very exciting project today on our Channel and that is using terraform so now I'll let Cloud Jam to introduce himself I know most of you are aware of him but still why don't you go ahead and just introduce to our subscribers hey everyone my name is cloud champ and I'm here to teach you terraform along with Abhishek so this is going to be a very exciting project where we will be setting up things through terraform which is infrastructure as code tool and you might have learned about AWS in previous uh videos by Abhishek itself which are very amazing and I'm very thankful to be here Abhishek to be honest I've I've seen your videos a lot and I admire the work you do you inspire me a lot as well so I hope today whatever we do is going to be very helpful for all your audience yes and this is very important because terraform is used everywhere so doing this project will help them understand how to properly create stuff using uh terraform so I hope this they found this useful and yeah I'm very glad to be here yeah the picture itself looks very amazing and uh here I can see that you are going to do this entire setup where we have the internet gateway we have load balancer you have a public subnet that you are going to create for us today ec2 instances and finally we are also going to get information from the S3 bucket am I right or yeah there are there are many more things as well like there are a few things that we haven't seen here for example when you do things on Console there are many things happening on the back end that you might not understand yes but when you do through terraform you need to specify that in the form of code so you need to say that this load balancer has to have Target group and it has to have some listener rules uh this this internet gateway should be attached to a VPC and there are many different resources for that particular thing as well so when you want to do this through terraform make sure it's very make sure you have your Concepts clear doing it through manually yes yeah so like uh Cloud Sam has mentioned please definitely go through the day 7 of AWS Zero to Hero course that link is in the description where we have done this entire setup including the private subnet theoretically from the UI from the console and I have explained each and every concept very clear so now yeah let's get started and uh yeah uh over to your Cloud champ all right so for you to do this project obviously you will have to have AWS account and obviously if you're doing this you will have it along with this you will also need to have a terraform installing your machine so I hope you have that as well and then we can start with setting up things so I'll be doing this very basically from the scratch on how you can do it if you're a very complete beginner first thing you will need is to have an IM account or if you don't have it you can create watching videos on how to create IM user but I am logged in as an IM user which is Nasi here so I'm going to create a keys which are required for you to connect AWS with terraform right so I'll go here in on my name and go to security credentials option here sure so when you when you access AWS through terraform you require access keys and secret access key which is not what you require when you use console because it is what console you require password but with terraform or with sdks or programming language you require a piece so I'm going to go here in this section which says access keys and I can create access Keys here so when I create access keys I can put whatever option is it so I'm using this for CLI and I'm aware so I can say I understand and I say next year and I can put a tag let's say terraform projects this is optional but it's good to have it so I'm then going to create access Keys which are here make sure you never ever share your keys with anyone I'm going to show you my keys here but obviously I'll be deleting it once the video is done so don't try to login I'm going to open my terminal this is a Linux terminal I'm using a Linux machine for you it might be Powershell it might be vs code or anything for me it's a table so I'm using this and I'm going to run the command AWS configure which you can do only if you have AWS CLI installed and to confirm you can run AWS version command which should show you output something like this if it's not there you can go to the official documentation and download the AWS CLI yeah so when I do this it's asking me to add the access key ID I've already done it so it says pu is what my key is ending with this but I'm going to put the new one that I create enough so this is my key and I'm going to put my access key here secret access key then they will ask me for region I'm going to choose the US East one and then output format is none now it depends upon the permissions of your IM user what access how many resources can it connect to what permissions that you have given to this IM user will depend upon you know I mean that that helps you to connect and create resources using terraform that is correct if this user does not have any access to S3 or any access to ec2 or load balancer or EPC I cannot connect I cannot create those in my telephone so make sure whenever you create a user it should have access to those particular services or even admin access if it is for yourself but make sure it has authorization and authentication done and then now that we are ready we can start with creating our project so for this project I'm going to create a new folder so I have a folder name that projects here and I'm going to go inside that let me clear the screen and right now I have these two but I'm going to create a new project let's name this let's name this so we are going to do everything from sketch we don't have anything perfect yeah so this is terminal so I'm running my command but if it's for Windows you will obviously use your file manager on my computer for this so let's name this terraform and we see for Abhishek and Cloud sham um I think sorry and I'm going to go inside this yeah okay let's open this in vs code I can do that by just running this code dot in my terminal or else you can just open it directly from here yeah so here's my vs code ready and now I'm going to start with it so going through the project we will be using the documentation to make sure that you understand things properly and also if you're stuck you can use them for your own references right awesome I think terraform has one of the best documentation in the devops space so you can find all the things you want in terraform so let's start with let me close these things and are we going to upload this entire thing that we are going to build uh to GitHub so that our subscribers can try it later yeah obviously we are going to upload this on GitHub it will be on my GitHub or it will be on abhishes GitHub anywhere but please please make sure to do this yourself before you copy or before you use the GitHub thing for references yes that's what it is so now first thing whenever we create something is to define a provider so what do you mean by provider provider is something that tells what is terraform when you run on so if we are using terraform with AWS we are going to Define providers as AWS if you're using Google we can use Google as a provider and you can find all the different providers by just running terraform provider command sorry provided in your in your browser and you can see the list of all the different providers that terraform has okay so provider is something uh where you can understand it as the platform that AWS sorry terraform is trying to connect let's say you want to automate infrastructure on openstack then openstack becomes your provider Alibaba Alibaba becomes your provider right that's right so using this you get like API uh you get to get the API access which can talk to different cloud services when you define it so when I Define it here let's say I want to use AWS and you can find the different versions sometimes you might be using particular version sometime you might be using the latest version right so these are all the different versions that AWS provider has this is the latest one which was released four days ago and let's say I want to use this so I can go here click on this use provider option and copy the format here if you can see here there are two blocks the terraform block and the provider block here so you can choose to copy everything from here and I'll explain you what these two does so right now we can only do the work with this part as well but if you choose to keep this terraform block you can Define what particular version you want so this is the latest one but you can choose to keep like any other version also things like backend S3 backend where you can store your state file which is kind of a advanced thing for now but even if you want to store your state file on S3 or on different backends you can have to Define it here in the terraform block so that is something which you might learn later on but it's good to know great so initially we used your IM profile and we try to authenticate to AWS now we are saying terraform that okay now we are responsibility with this project is to automate infrastructure on AWS that's what we are trying to do right right so we have defined this provider here but along with this it says there are some configuration options that you need to insert in this and if I go to my documentation of AWS provider you can scroll down to see what configurations you can enter so inside this configuration you can see you can enter region you can enter access Keys secret access key and also other few things but if you look here it says there's a warning saying hard-coded conditions are not recommended in any terraform configuration this is why we are not putting our access Keys here and we are putting it in the AWS configure command perfect other options could be defining environment variable it could be using the tfrs file as well but for now we are only switching up to using AWS configure and let's define a region that we want to use so I want to use U.S east 2 or east one so not original okay and you can get this if you're not sure what is the name or you can just click on this region block and choose to use which one so you have to use these names here got it all right now we are ready so when you define a provider you have to run few commands to make sure that your vs code is ready to start creating resources now and for that you need to run the command which is terraform in it if you want to see all the different commands you can just write telephone if it is installed and then you can find all the different commands here so these are the main commands that we are going to use throughout this uh thing but if we get more advanced and you're working properly you can also use these different commands as well awesome and if I show you what it does here you can see it says prepare your working directory for other commands so this is the first command you need to run when working with terraform if you don't run this terraform will not know what is going on you are basically initializing terraform here yeah that's that's right we use in it mostly like in very different in many different devop tools like even when you use Git You have to get initialize it similarly there are firm in it so I'm going to say it out of a minute here and it starts to initialize the back end you can see it's also installing the hashic up AWS thing so it can be connected and we can then start working so if everything is good it should say terraform has successfully initialized and you should be ready so let's see so this this will be your first step of verification to confirm that you are connected to AWS using terraform that means now you can automate things using terraform on your AWS platform right so you can see it says terraform has been successfully initialized you may now begin working with terraform and we can now create resources and then run terraform plan to see it apply to applied and you can see there are few files here which terraform automatically creates and this stores the information about the provider that you don't need to worry about you only need to worry about the things or the files that ends with DOT TF not to touch any state file not to touch any other file okay so now I'm going to create another file let's name it main.tf and you can choose to put everything in one file but it's good practice to separate it and we can also separate it through modules that we will be that you might be learning later on in abhishek's video or I might be creating it but for now we are not using modules to make things simpler and to help you understand it better so if I show you the diagram again this is the diagram in this diagram we have VPC inside the CPC we have few subnets here so one two minutes inside this subnets we are going to also so this group is also connected to internet gateway so that internet connection can be passed we also have route tables to Define that this internet gateway should be connected to this particular subnet yes after that we have done it we need to create ec2 instances when both of these and then attach IM rule also put them behind the load balancer and give them S3 access so there are a lot of things here that we need to do and we are going to use a create many resources for that so let's start with yeah peace yeah no I was I was saying like uh let's say you are an absolute beginner or let's say you haven't used terraform before or you are just learning AWS so what I would recommend you is to first try this project using your AWS root user because sometimes because there are multiple components involved you might get frustrated with respect to the permissions that you have to assign to your IM user so initially you can start this project with the root user but eventually understand that this has to be done with a im user only right this is very also very good advice even when I was working with terraform in my company so they used to tell me that whenever you want to automate few things through terraform make sure you understand or you have knowledge of how it is done through the console only then it will be easy for you so let's say if I'm creating VPC in my terraform code I need to understand how is the VPC created in console because when I click on create VPC here you can see there are like this is the automated way but let's use only VPC here so here you can see it's asking you for a name and cider that is ipv4 side range right so these are the two parameters that they want and this is optional so similarly when you create VPC through terraform you will have to enter this option yes again when using ec2 instances you will have to put Ami you will have to put a security groups keep as whatever you have in your call and you need to understand what happens when you put don't put it like for example if I go to ec2 here and I try to create ec2 without entering the security group or without entering the key pair the default value is to use the default option if you don't use keeper it will go ahead without keypad so those are the things that you need to keep in mind yeah that's why I will highly recommend you to watch day 7 where we have discussed about this entire project through the AWS console and today we are trying to automate it using terraform right and we could have done this without creating VPC as well but yeah it's always good practice to have your own custom VPC so you can have your own custom configurations for networking right so we'll start with creating VPC now in here if I want to create a VPC I need to define a resource a resource is something that creates infrastructure on aw yes so we as we are creating a VPC we can go and directly use the official documentation for that so I can just save AWS EPC can you increase the font a bit yeah please yeah okay well it will be this is just the yeah and this is good right or should I add a little bit a little bit would help perfect yeah this is the module I don't want to use module I need to use the terraform VPC resource so I'll say terraform VPC resource and it will give me the uh research documentation somewhere it's awesome okay let's give you PC yeah it's going to the modules we are trying to get the screw from here we can select the subnet here and then we can choose to go to the VPC section from here so you can see all the different resources are present in the documentation I can scroll down to find VPC as well so VPC is here so you can see inside VPC there are network ACL Security Group default bpc all these things we're actually creating a VPC simpler we just need to use this one okay so I can simply copy this if I want to but it's better to have it written yourself so I'm going to write it down so I'm creating a VPC saying AWS underscore EPC and then I can give a name this name is just for terraform reference not what you will see on your console so remember that inside this I can add some parameters so you can see here it is asking for cider block uh you can add tenancy as well or you can add names as well for this we are just going to say cider block is this and let's define this so should we do it on variables or do you want me to put the values like this uh depends on um yeah you can for the purpose of video you can put the values here later we can just tell them how to create a variables.tf and how to reference like with one example that should be fine but let's do this one fifth example and then rest of all with the uh yes so let's say if you are putting some values it's very good to always have a variables.tf now this is just one way of defining variable there are many other ways and I've also shown that in one of the video where you can how you can Define variables so this is creating a variable block I can do that by running variable and if you want to ask what what plugins are you using uh can you share those things also because you know uh it will reduce a lot of effort for our subscribers yeah this is what I was going to tell you so if you want to have this autocomplete feature and also getting more information you can just so the one I'm using is the hashicop's OWN terraform extension you can choose to use this and you also have this one which is also used by like eight zero three people three but this is a the good one by hash Cup itself so they are the maintainer so you can choose to use this okay thank you right so now inside this I am going to put the value which should be inside in the form of variable so I'm creating a variable here let's name this as anything let's decide it okay yes I'm going to put the default default equals to whatever value I want so I want to have the value as 10.0.0.0 16. so this is the iPhones that we want to use for our VPC and I'm going to if I call this VPC from here so they call this variable that is defined here so you can say What DOT C idea the name of T variable so this way it will use the value from the variable start here awesome okay so now we have defined the resource for VPC it will be created when we do it but let's go also create two subnets here so I'm going to say AWS underscore subnet and you can always use the documentation as website so let's name this as sub 1 and inside this we need to pass few parameters so for parameters are we have to Define what PPC are we going to create this somewhere inside and then what should be the range and to make uh things more clear they can just go to VPC okay so we have to reference the UI and when you are trying to build terraform so always keep your UI as a reference and the documentation as the other reference so that you understand what exactly you are trying to do and this will be easy for you once you have not like once you have practice you will come to know what is to be done so you can see when you create subnet it's asking you select the VPC that you want right let's go with this one then it is asking me to give the name then to give change tell me which AC do I want to launch this somewhere into and then what should the side arrange so these are the same things that we are going to attach in our terraform as well so first thing is to Define what VPC I am going to create this so I'm going to say VPC underscore ID and I need to say this subnet should be inside this so I can reference this by saying awscpc.mybpc dot ID and what I use is I just copy this thing from here all the time and then paste it remove the codes from here and paste put a dot between then Dot B this is how I create dependency and you should be doing that as well right yeah once we do this the next things we need to Define is the cider block so I'll say cider block which should be inside the same range so here we are using slash 16 we can go with Slash 24 years so let's define this as 10.0 dot 0.0 24. yeah basically you can assume that uh you have created uh VPC with a lot of Ip range and within that you are creating a subnet like within the VPC range you are taking a small area and you are creating that particular subnet range right because when you choose slash 16 you get around 65 000 some IPS and within that 65 000 you're giving some like 256 of these to this particular subnet and then other to others so I'm going to now Define few other things like what AC do I want to launch this into so we are using Us East one so I'm going to say I want this to be in U.S east 1A okay so it's a U.S east dash one dash eight and one more thing is to have map public IP on launch which means you can give you can give a address as public IP address to that subnet which and you can find all the different arguments from here in geography documentation so if I search for map uh map public IP on launch so this says specified true to indicate that instance is launched into the subnet should be assigned a public IP address and they will require this because our instance should have IP address so that we can see what web server is it creating yeah so you might be thinking that uh Cloud jump is doing it uh you know with so much ease because of that practice that he has now uh he understands what resources are required I mean what parameters are required inside the subnet block inside the VPC block so this comes with a lot of practice now when you are doing it for the first time follow this video keep the AWS documentation with you and the terraform documentation with you that way you will understand it very clear what exactly is happening that's right and it's very very fine to have errors errors can teach you a lot than any other documentation or any other things so make even if you get errors try to solve it yourself before you ask anyone uh try to spend like two to three hours configuring it because when you troubleshoot things it will teach you a lot of that's my personal experience yes so we're going to use this argument which says my IP and I'm going to say true because I want to have IP addresses attached to my instances inside this particular subnet okay similarly let's get another subnet I can copy it and put it here we need to change few things the first thing is to change the name here we cannot have same names so I'm going to say sub 2 and also change the cider block I'm going to use 10.0.1.0 and let's change this to 1B so we have two subnets in two different azs now okay so if you want me to create it now or should we go ahead and add few resources and then probably probably right now you can show in the picture what we have done till now I mean we don't create it on the AWS at this point but at least from the picture we can explain what have we done till now okay so according to the code we have right now we only created this green line which says VPC and this uh the screen subnet inside the easy so this is the AC inside this we have This Is Us East warning this is usd's 1B so we haven't really created VPC and subnet node resources yet no internet gateway no route table okay perfect we can proceed with the next steps right so when you create this it's all private because you don't get uh the internet right away even if you uh so we have to attach internet so that we can access our ec2 instances on the internet and for that we can do this by using internet gateway so and if you if you don't know what is the Gateway is you can check out the videos on it to understand it and it's a VPC component so you can find it here inside this section so we need to create it first then we need to attach it to a VPC and we also need to Define it the routes in the route table so of course we will be creating internet gateway and then we will Define the routes in the route table later on so for that you can again use the documentation so I'm going to go ahead and create a resource for infinite Gateway I'm going to say internet Gateway let's name this as igw okay and inside this we need to pass a single parameter which says what VPC are you launching this internet gateway inside so I can copy the same thing which is this because we are creating this in the particular VPC that we created earlier so I'm going to put this here and this is going to be creating our vpa the internet gateway but not actually uh not actually giving the access to these subnets yet okay so forgiving access or to you need to use route table so if I show you the default out tables you might get an idea of what it actually does so this is the route table which defines where should be the traffic go to okay so this this is the main one the default one you can see these are the routes then the submit Association so we need to Define that every thing in this subnet or in this VPC should go to internet gateway and then these are the subnets I should have so right now there are no standard Association done because this is the public one we are going to create our own uh but just this is just for your in clarification that this is how routes are done or this is how energy Gateway is attached to a public subnet yeah basically I mean here the route table defines let's say you have a subnet and how the traffic has to flow in the subnet so that is explained by the route table so let's say there is an instance or let's say there are some packets flowing in the subnet so if there is no route table you don't know the path or how the traffic has to flow in the subnet now that's what we are going to do right now right even when we create our table as you have seen there's one route here we need to Define that manually but if you do it through terraform you also have to Define that so let's go and create routable here now so I'm going to say AWS route underscore table and if you're not sure what name is always always use documentation let's name this my RT okay just Rd is fine so in this I am going to Define where first it's going to be the VPC ID so where is it going to launch so I'm going to say it's going to be launched in the AWS dot VPC AWS underscore vpc.myvpc and then dot ID in terraform always checks what it is asking for is it ID is it Arn is it Security Group is it name IP address so depending on that you can put the argument uh like that okay yeah now when you might have done it for the first time uh the route table and this one right you might be using the AWS documentation or were you doing it from the console how did you learn actually has to go into route table how did you learn I obviously followed documentation but it was when I started the first time it was through the videos I used to I used to watch AWS videos on skill Builder the three ones but then when I was having my internship I took up most on udemy okay so yeah it was he taught me a lot I would say yeah great great yeah so inside this out table you also need to define the route as I've said so let's define the route for this route we need to so earlier there was there was a separate result just for the route but now in the new they have these things so you need to make sure that you're using the configuration properly and you always have a command like running from validate to check if everything is perfect yes and if you have issues you will come to know which line is it and you can then refer the documentation to change it so no problem even if you get issues even though if people are working in it for like 10 years and 20 years they still get the issue every day so that's not a problem so inside this I'm going to say cyber block because if you see here it's a cyto block this you should connect to this so I'm going to say 0.0.0 0 which means everything inside this VPC should connect to a particular thing which is Target here so I'm going to say Gateway we are going to connect it through Gateway and this is another Gateway which we created here so I'm going to say AWS internet gateway.itw dot ID okay so same thing as we have done here this is what we have done inside this routing okay got it so you are basically uh attached I mean you are what you are trying to do in this step is there is a public subnet that we already have now after this we are going to take this route table which has the destination as the internet gateway and probably we are going to attach this to the public subnet right right yeah so next step is to attach this to these two subnets so we can do that by using the resource which is public supplement Association so you can find them again in the avpc section so here uh you will find it subnet Association part okay uh if you don't do it manually you will never try to I mean you will never understand that this is your next step now knows that his next step is to do the public subnet Association because he has practiced this manually multiple times now probably if you don't practice that you would create routable you would create that and you will not receive the traffic because you are missing this step so yeah uh practice that's it so this is the resource that we're going to use to connect our route table with the particular subnet so sometimes the submit is public sometime it is private so you need to Define it to the proper things and if you see that same thing in the console this is how you do it so like if you go to Summit Association you need to refine and then select whatever subnet you want to attach and then save Association okay similar thing we are going to do through terraform so I'll say this last name is now AWS underscore route table let's confirm the name once the name route underscore table underscore Association and I can call this anything let's call this as rpa1 okay and inside this I need to Define few parameters versus to what cabinet do I want to attach and second is where is it going to be attached so here this is where we are going to attach it so I'm going to say subnet ID is going to be the first Subnet so let's copy this one here with it here removing the quotation marks putting a dot in between so AWS underscore subnet.sub1 Dot ID so this means this is the subnet that I want to associate with this thing so we need to also Define this by saying route table ID so this is a routable ID I'm going to copy the name and also remove the puts input.id width after that all right so this says now this subnet is associated to this one so whenever it is connected it will have public IP a public internet connection because similarly we can also do that for the second subnet by cropping and create another resource here so saying sub 2 same thing and now it's ready for something like two as well okay so this is kind of ready for our VPC section uh apart from the security group so should we go ahead and see this yeah maybe now we can show what all the things that we have done till now and how it would look on our AWS platform right so there are only two subnets sorry two VPC just to make sure that I'm not having things earlier before running the commands yeah this is having a 172 172 cider the one we are creating in vpcs has 10.0.0.0 come on so before you run it there are a few commands that you need to know the first command is to check if everything is correct or not and always make sure you're saving the terraform thing if it is not auto save for you in uh vs vs code because if you don't save it it uses the previous version but always save it so first thing is to reject this by checking if everything is perfect the syntax is right or not so you can see here it's gave me an error so let's see what is the error here so it says already declared okay as I said name should not be correct name should not be same sign is to change the name here because I copied it twice configuration is valid perfect so now let's run the command to check what is going to be created or deleted or done like right now we're going to be created because we have this is our first time writing this code I'm going to say there are some plan to check what is going to be created okay it's to uh it's kind of a dry run that we are trying to do on the AWS platform which will tell us that okay when you actually apply this configuration these are the things that are going to get created that's right so if you see here it says plan says seven things to add zero to change Zero to destroy perfect and it's going to create VPC two subnets for us one round table associate that subnets with those out table and internet gateway which is all we have created for now and if you see this plus symbol which means it is creating if it is minus radical or it is destroying and if it is yellow the wavy symbol which means it is changing sometimes perfect so now we are okay with this let's go and run telephone apply command telephone is going to actually create that thing in the console okay and this can only be done if you have your keys connected properly if not you will get an error yes so I'm going to enter from apply it will again show me the plan and ask me if I'm sure and I can type yes so let's let's do that so yeah you can see it has show me the planet says do you want to perform action only yes will be accepted so I'm going to say yes now and if we'll start creating the resources now you can see it's creating and we can also check that by just refreshing here so you can see it's all almost done like the VPC has been created in just four seconds you can see the VPC here and that was creating internet gateway creation complete foreign is so much use because it can do things very very fast and you also have a kind of recovery if everything is lost you can just run the command and have it again so while this is getting created uh lot of people who are trying to get into devops or aspiring devops they have uh fear that terraform is very difficult you know there is so much syntaxing in terraform right and you know you have to write large yaml files or not yaml files sorry large uh the hashicor templating format files so what do you tell them like personally when you learn terraform uh how did you find it was it difficult or with practice you gained this expertise to be honest I would say terraform is one of the easiest devops tools I uh I have came around yes because if you have some knowledge of AWS let's say you have AWS associate certifications and then you start learning terraform it will be very easy for you obviously you will have to spend some time to learn the HCL syntax and things which will be helpful when you practice every day and when you do this and you have your resource in your AWS it it is it boosts your confidence and then you will learn try to learn more things in uh in that confidence so I learned all of this in my internship which was like six months or something and I also got my aw terraform certification through that so now and now it's very easy for me but obviously if you spend things you will always learn and there are many more things to learn in terraform like even though if you think you know how to create this there are many more advanced things like you can use terraform to set up CI CD uh a lot more things yes there is a lot more to learn as well this is just a starting point but obviously if you spend time if you look if you ask me about the syntax I think it's very easy compared to other programming languages because this is what we use all the time we use yaml and Json so this is very very similar to yaml Json and I have a video where I have explained how what is different resources what are different blocks and what is these arguments values so if you need help you can also refer to that sure that's great so yeah even personally I find uh terraform not that difficult uh because once you master the cloud platform that you're working on right so when you want to create some bunch of resources or a bunch of like let's say you want to create a stack right so there should be a picture that is in your mind okay these are the things that I want to create now when you have that clear picture you can simply write down the steps okay first I have to create a VPC then I have to create subnets in it then I have to associate then you know those things terraform documentation is a wonderful place just go to the terraform documentation most of the times you just have to copy paste things right yeah and you have this cool Visual Studio extensions where it will help you in Auto completing and syntax highlighting so what else you need it's a very very easy language just get that fear out of you your mind and yeah Cloud champ also has some good tutorials on terraform I am also going to do a complete terraform tutorial so don't worry I think most of the people in devops are just feared about all these different tools like if they try to do it once they will come to know how easy it is spending time with proper roadmap learning the things that you should learn first and then the later things I think it will not be easy like it will not be difficult for anyone perfect so yeah we have our things ready now you can see it's been created all all of it so if I like I figured out the resources based on rvpc this is our VPC here and we have two subnets ready uh two of them we have route table the default one but we are using the non default one which is this and we also have route defined as internet gateway and subnet Association done for two subnets that we have here Okay cool so how much have we done with our project from the picture point of view so in the picture point of view we are done with this this and this outer part here we have ec2 two ec2s uh load balancer I am roll and the S3 Parts left let's do it okay so now first thing we're going to do is to define a security group that we might be using for our ec2 instances and also for a load balancer you can choose to create a separate Security Group for load balancer but it's up to you I'll show you how to do it so that you can use it as a reference to create it for other resources as well like load balancer having a separate Security Group and easy to having a separate one sure so for that you need to use the resource name which is AWS underscore security underscore group and I'm going to name this as my HG so in this we need to First Define like what is the name so I can post the prefix here the name prefix equals to what is going to be the name so I'm going to say web underscore SC so this is the project I want to use so uh this is and then it will have ID most probably in this when you create a security group you always need to Define two things inbound Rule and outbound Road yes go to security groups here the security group is Now the default one created you see there is inbound Rule and there's our outbound rule so by default if you create a security group you will have no inbound rules and all outbound rules so we need to Define some inbound rules because we are going to use our in simplest we might be necessary into it or you might access it on public internet so we require Port 80 422 so let's add that first thing I'm going to do is to add Ingress Ingress means inbound egress means outbound so in Ingress I'm going to say from Port if you want to check you can always use the Security Group documentation yeah because I know if I try to just say things it will be confusing so rather it is better if you use the documentation yes so AWS underscore Security Group resource should be somewhere here okay yeah this is the resource uh you can see here there are a few descriptions here it's also asking you for the VPC ID I can also choose to put this let's copy this one here and try to edit it maybe let's copy this entire thing and try to modify yes I'm going to now remove this thing and also this let's face this and inside this we have few things let's change this to our own so our VPC name is my VPC not main so I'm going to change it to my VPC dot ID and I can Define so let's choose to change this now let's say Webster web SG description we don't want but you can choose to keep it inside this I'm going to change the port number we don't have SSL so we're going to use S80 here and let's change this to 80 side of block can be anywhere so let's do this 0.0.0.0 that means everyone can access this instance yeah and this is list of uh IPS so we need to put them in like this yeah Square packets so I need to put this in square bracket again and we don't want any IPv6 because we don't have any IPv6 yeah so we can remove this copy this again if I want to have another inbound rule so I'm going to copy this and put it here to have another set of Ingress make sure the indentation is correct or else you will get an error so it has to be two spaces and then now it's correct so I'm going to make this 22. to have SSH okay hsh and this also 22 so TCP protocol anywhere and this is my http okay here we have said egress is saying 0 to 0 which means all all ports for everyone for all IPS so it means everything is allowed here sure we can remove the IPv6 block it is not required for us okay let's remove that cool all right so yeah we have our security group ready as well now we need to create our instances inside the subnet we have created as of now but uh yeah we can create that now or we can do this after we have our secure let's read ready so there are many times you might have to create S3 in terraform for a lot of different use cases so you need to know how to do it and that's what I'll be showing you now on how to create it so creating an S3 bucket is very very easy you can do it in just a single argument which is the name so let's do that by showing you here bucket is the resource and we can find it here so this is the example you can see you can just create a bucket with single thing but if you want to add a few parameters or configuration like enabling starting website hosting or course you need to then create few more resources about it so I'm going to copy this code again and use it here in a configuration let's name it something which you might have never used or which no one has used because it has to be globally unique unique names so let's say this uh abhishek's terraform 2023 project hopefully no one after this yeah hopefully yeah let's see we don't need tax but it's they're all because they're optional yeah making a code shot I'm going to remove that now our bucket has also been defined inside this bucket uh if you want to let's say make the bucket public or if you want to give some more configuration you can choose to add that I have the snippet here so I'm going to just put this no need to like Define it for now but I have it so I'm going to post it here also I'll show you how to upload a data upload a file so we don't have any file but let's say we want to upload this particular thing and then how we are going to do that so we can do that by using S3 object uh resource so I also have that somewhere here so I don't waste time yeah or maybe we can show that at the end firstly we can yeah let's do that at the end so I have the bucket ready and the bucket is now public present and the ownership is also set this is required when you want to make things public now let's go and create our ec2 instances inside these subnets okay to create some resource uh easy to instance you need to use AWS underscore instance ec2 underscore instance uh thing or you can obviously refer it again it's better to refer things because you might not know that if they have updated things or not yeah that makes sense so this is the ec2 instance okay this is the here this is a resource it says provide an institution resource so it just AWS underscore instance not easy to instance all right in this I'm going to say web a server one okay and inside this should we minimize the vs Studio terminal so that yeah perfect okay so here we are you can see there are few parameters you need to look here so the few parameters like Ami instance type so whatever things you insert in your console when you create things that is what you need to enter here as well so if you want to keep it if you want to add a security group anything like that you can put that here in the resource block so here we have to create let's go with creating Linux uh Amazon Linux or maybe uh let's go with Ubuntu here yeah so Ubuntu is the mostly used one so if I want to do that I'm going to first specify Ami and I need to put the Ami ID I can choose to use the data block to get the Ami directly from here but it would be easy if you understand how it is done so I'm going to go to ec2 console and make sure to use your own because Ami IDs are different for every account region so you will have to use you so I'm going to click on launch instance option here and then I will have all the Amis present here so let's say I want to use Ubuntu I need to click on Ubuntu here and then let's say I want to go with 20 version so I'll choose 20 and whatever version it is I will get the Ami ID here okay use in my uh there are some configuration so make sure you put this in double quotes because it's a string yeah as you have seen it is instance type there's keypad there's VPC settings there's a security group all those things that we need to enter right so we are going to say instance type is instance underscore type is going to be T2 micro uh because we don't want to waste any money this has to be in three tier for now everything that you have seen is in three tier you're not going to spend any money if you have a free care account so there are there is going to be a load balancer very soon in this configuration which we're going to cost you money but it will not cost you much if you delete it after the project is completed so create this project take a screenshot or share this on LinkedIn tagging Abhishek and me and then you can delete the resource because I don't want you to get charged because many of them are students are yeah so yeah all right so in this uh I am going to then also Define the security group so I need to define the security group by saying this thing VPC Security Group IDs and it's a string in list of strings so we created a security group here this thing AWS Security Group Let's uh use this one I'm going to change the name to say anything let's say okay so I can now use this copy and refer this here by saying sorry web is small G is that they should give me yeah you should give me this okay so we have many things here like it's big G there is a small G let Me remove that so that we don't get errors later on okay so we are saying I want to use the security group which is created now and I want to uh Define that so I need to save AWS Security Group the name of the security group dot ID and this is going to be in a particular subnet so let's put this in subnet one that we created so I'm going to say submit ID equals to AWS underscore subnet.sub1 dot ID cool okay uh I also to make things more interesting we can choose to put the user data so that whenever we launch this instance it should have a sample uh thing on the web page on Port 80 because we also have Port 80 allowed in our security group so this is how user data in here section so basically you are creating a startup script we can assume that way right yeah so sometimes there is a use case where you might need to install some of applications or some software or maybe set up some things you can do that by using a batch script and put it here so similarly if you were doing it in terraform you can do this by first creating a file let's name it as user data Dot sh script my script ends with DOT sh all the time so I have a sample one here let's use this I'm going to copy and paste it if you see these are the commands that are run in Ubuntu so apt update install Apache this is the instant side that we want to see on our thing it's going to have this as well let's comment this out because we haven't given H3 accesses up now I'm going to give SD access later on as well but not now and then it will show us the sample page which will show us that this is a terraform project will come to abhishek's channel and then start it so if I want to use this here I'm going to define a parameter saying user data so user data can be defined in different ways uh like if you can choose to keep put the value directly here but it will make your code bigger and not best practice so we are going to use the file element so if I show you the file element first let's we change this to so I was doing this earlier and I was giving error because it was not uh encoded or decoded when you choose here now you can see user data has already been basically encoded so we need to encode it outside so I'm going to say encode this one by saying base64 encode and then choose the file so the file is user data as sh so user data dot sh awesome so now when you start this instance this script will run and install the software and probably if someone tries to access this instance they will see welcome to Abhishek channel right right because that's what our script is saying so we need to use this like this now that it is ready we are we haven't created any uh we haven't created any key fairs or anything so we are not going to add that even I am thing we are not doing for now so I'm going to uh skip that for now let's create another resource another instance in different security different uh easy okay and this one let's call it as uh Welcome to Cloud champ to make sure that whoever tries to access the load balancer they'll see the proper load balancing right one is welcome to Abhishek veeramalla and other is Welcome to Cloud Champs so to do that I'm going to create another script so two scripts are used in two different resources and let's use this so I'm going to clean this to Cloud jam now so that we can see how load balancing is done properly you should see the different names I'm going to save this and in here I also need to change that this server shows change the name to web server too because it cannot have same name it can have same Mi because both of them are in same region and same account next we need to change this to web sub 2. ID so it's launched in different subnet and changing these data to dot sh okay the VF now VPC and all the components with a security group with S3 bucket and with two instances ready so according to the project diagram that we have here and let me show you everything is ready except the load balancer and also the IM card yeah okay so let's do you want me to show it to now like even yeah like I think we can keep that IAM and S3 bucket access later let's try to access the project right now yeah let's do that let's see if everything is coming up according to what we have defined so make sure you save every file that you have just to make sure that it does not show you any error so now as you have seen that seven things are already there if I just run terraform apply or plan it will show me other than these seven things right so if I do error form plan it okay then twice yeah and I'm going to say telephone plan here so it says there's some issue with has not been declared okay I'm using the wrong bucket name I've copied the thing so I'm using the wrong button yeah the bucket name is not this so I need to change this to our bucket name which is example bucket so I need to make an example perfect and let's change this to example as well so this is how you will come to know what is the error and what you need to change when you try doing it so now let's see what happens when I enter a phone plan this was this code is from the previous previous uh project like this yeah previous S3 project that I created so it has to portfolio bucket name in it no worries okay let's use this and ion thing we also need to change this so bucket ownership has example one here let's put this here Public Access block has uh I think we don't require this so let's remove the depends on Section let's call is okay let's run the terraform plan now yeah this is a cool part of debugging right when you're doing live things and when you debug in live I always tell I don't even edit the videos when there are debugging when there is debugging involved so because the subscribers will get to know how actually we are debugging these issues right so yeah because so you can see there's always this again this error so if you show things even if they get the same kind of error they will get an idea of how to troubleshoot them yeah because you just hide them then they are confused and then they leave the project in between uh thinking that they are not able to do it so you should always show how you troubleshoot things if you yeah do it so now everything is ready okay it says six things are going to be created So Sick Things include our security group bucket has some ACL and Public Access as well so three resources for buckets and then we have our cool ec2 instances here as well so this is our first instance which is this one web server too and then also web server one okay let's go and run the data from apply commands I'm going to say terraform apply and it will again ask me for uh yes and no prompt so I'm going to just say hyphen Auto hyphen approved which will skip the prompt and directly start creating it awesome so now it should start creating the bucket to ec2 instances and a security group in my account yeah you can see it's going to now started so you can see this is creating bucket Security Group if I show you that in the control right now I don't have any instances running nor stopped okay I have two of them pending this is the one that we created so you can see it's in pending state right now great if I show you the bucket bucket might have already been created okay this is the bucket let's move through the spot you can see Abhishek terraform it was not taken lucky oh yeah yeah this is an empty right now but uh we will we might add a few things later on sure let's wait for this to come up yeah meanwhile while this getting created what was the issue the issue is regarding the access at night let's remove the bucket ACL part we don't actually require it it was just a thing in the previous one so I'm going to remove everything just keeping the bucket okay let's move okay now it's ready now that was not required anyways yeah for this project we know we don't need any bucket ACL as in specific right yeah because it's okay if it's public or private we don't actually acquire it we are going to have an IM rule that is going to give access to uh S3 but that does not require any other properties having a bucket is all you need for this project okay so now it has been deleted according to the terraform configuration and our instance is also ready if I show you my instances in the ec2 dashboard you will see that these two are in time perfect all right so it's initializing we have to wait for it to come up in two by two status checks because when you have a ec2 instance user data script it does take time to install things and bootstrap thing on the back end yeah we will have to wait for it so if you see here these are the two statistics and already initializing right now let's wait for it to come up and you can also check like what user data script is used by going here to instance settings and edit user data section and you can pause the script that we have referred so you'll find uh please find welcome rabi shakes channel the same thing that we have used in our code which means it is going to use sometime you might get an error that your script is not running it might be a single syntax issue or maybe a command issue wrong command so always make sure to try running it in your local machine if you have a Linux one or you can try running it so make sure that the script is correct because you don't get the errors this is all done at the back end we are not assistant to it so yeah let's copy this and try to open it to see it obviously it should it might take it might show us an issue because it's not ready yet but if you see here it's ready actually so it says terraform project one it gives us the instant ID and finally it says welcome to abhishek's channel wow this is a cool script and where did you get this instance ID from how did you fetch that so if I show you this script here like in ec2 you have something known as metadata which stores all the data in a particular IP address which is 169254 this part so we can get all the different kind of data you can also use this like if you call this in your local SSH NPR and call this you will get all the different data so we got this from instance ID here using this thing and so our subscribers can also use the same IP address right yeah they can also use the same thing because it's all same for every every easy to instance so you can use the same script if you want we should be there in the GitHub so yeah you can always refer this let's also check if the second one is ready or not so this is the same Welcome to Cloud champ yeah great now let's get the load balancer in and let's see uh if we can load balancing if we can load balance this using terraform that's the final part that is left even I am if you want to cover it but let's see maybe let's try to do that in a different video because I don't want it to be overwhelming for the viewers as well maybe we can ask viewers to try it now they have how to do it you can try to create an IM Rule and see how you can access it how you can how your ec2 can access S3 that could be a challenge if you do it make sure to share it on your linkedins on your social profiles and to share to Target so that we can see if you have actually done it as this project I think would be very enough for you to have to understand how to do it using the documentation and the CLI and the UI so yeah let's go and do the load balancer product which is very very confusing and there is always an issue when you do it so yeah I will try to make it as easy as possible but obviously if you are doing it make sure you know how to create a loan balancer in the console first so you will find load lenser here and there are actually three four types of load balancer so right now we don't have any load balancer if I click on Creative balances asking me what type of device do I want so application or network or Gateway and then I create it then I need to put some things here like it is internet facing it has this EPC it should be in this subnets all these things right so we are going to enter all of this along with this we also need Target group as you see here also netlistener and all the different things and it might get complex but I'll try to make very very very easy for you so let me close this okay all right so we have uh things ready let's go and create a load balancer so create ALB okay we are using application load balancer here L7 perfect layer 7 load balancer and we are going to use the documentation again for this so if I guess so you have this data sources but you have AWS elv it's a data source that you are referring yeah data source is things that you can use to get the like resources or parameters from to your to your code so in here I'm going to use a resource let's name it AWS underscore lb load balancer earlier it was having ALB and elb separately yes but it has just LP here so I'm going to say my ALB okay inside this we need to first few parameters the first is going to be the name so I'm going to say uh my Alp or it can be anything so and next I'm going to say if it's going to be public or private or internal so I'm going to say internal equals to false which means it's not internal after this I need to also Define what is the type so here we are defining load balancer but the type is application or is it Network or is it Gateway so I'm going to say type type those Valencia type equals to in double quote I'll say application so this means we are creating an application load balancer okay okay along with this if you've seen in the uh in the section here it's also asking you for a few of the things like security groups and ppcs are going to be attached in the other parts that like Target group you have to create a separate resource for that so in here I'm going to say security groups so the security groups is going to be the same security group that we use so I'm going to the instance this one so but you can choose to keep like it's good practice to have different security groups to enable more security uh like having a Security Group which only give access to the load balancer through each other but uh we're not going to do that so security groups we're using the same one and along with this we also need to Define what subnets are we going to uh attach or be able to have so inside this if you see there are a few subnets that we need to select and we have to offer our subnets ready so the two there are two subnets which means list of subnets I'm going to again put this in square brackets and Define the two subnets I'm going to say AWS subnet dot sub dot one dot ID and also the next one following by a comma saying AWS underscore subnet dot sub 2 dot ID basically we are assigning the load balances the subnet because load balancer is managing the traffic to two instances right instance one and instance two and one of the instances in the public subnet one in one availability Zone and the other one is in the different availability zone now load balancer should have access to both of the subnets so that's why what cloud jump is doing is he has taken this load balancer trying to associate both the subnets with the load balancer and additionally what we will also do is we will create a Target group that we are going to create now with Target group we will tell load balancer okay so this is your target if someone is calling you then send the request to this Target and Target will send the request to the instances that's right the next step is to create a Target group so to create Target group you're going to say resource and if you want to click on name view to this let's say tags and then you can give a name by saying uh the same web web just everything so in this I'm now going to create a Target group so I'm going to say AWS underscore LP underscore Target group so that's going to create a Target Group which will hold the instances behind the load balancer so that repressor should know what what to balance the traffic among so in this I am going to name it first so name name can be my TG you need to Define what port should be there and all that stuff so if you go to Target groups here you have to Define what uh what instant site but also what is the name what is report what is the protocol what VPC is it and then create it right along with this hell checks so we will have to define the same things again so I'm going to say Port is going to be 80 because we don't have SSL so we're going to use AP port and then we have a protocol which is HTTP protocol as we have here so I'm going to say HPP and in this we also need to put the VPC ID so you have seen we need to refine what VPC is it okay this is ready we know also need to put the health checks part here defining what should be the health check Port all of these things so inside health check we are not going to put everything but still we need to Define what path should it check because this is the actual use case of Target group it will help targets are not ready or not healthy you should not put the traffic so we will have to obviously Define this I will say health check should be done on the slash path which means the Home Path uh if you see here our instances are also running Where is the okay as well our instances are also running on the slash part slash means just this will be just back to the home if you have any classes let's say slash uh video slash post something like this then we will have put that path in there but we are doing it just on the home path we are saying slash path is this and then Port is going to be traffic port traffic is important you can also choose to add things like status code if you want to have a particular status code like 400 or 502 or something you can also do that okay all right now that we have done this our Target group is ready but it's all empty inside we need to Define what should be inside that Target Loop so we are going to say resource and we will say AWS load balancer targeted attachment so AWS lb underscore Target group attachment test results this is going to attach our instance with the target group so we'll attach one and then inside this side we have to add two parameters one with the IDF instance and second with the idea of uh ID of the title group so I'm going to say Target group Arn is going to be the AR and of this doc input that we have so we can copy this so this time it's not asking for ID it's asking for the Arn so we need to put the dot Arn thing similarly next I will need to put Target so I'm going to say Target ID and the target ID is the instance that we have so I'm going to say AWS instance.web server.id and we also need to Define one more thing which is port so Port is going to be 80 because that's what it is going to run on yes and we just Associated one instance right uh like so how do you want to uh attack like okay so this is the target group it has only one instance but we want to manage load between two instances right so do we want to attach both the uh do we want to add both the instances here or how do you want we can have similar results copied and created again but let's say you are doing this uh for a production environment and you don't you don't have to do it like this then you can use counter index or you can use for each or map things where you can choose to reduce your code by having all these things at once yeah so now we have two things ready but this load balancer is not actually attached to a starter group so like we have to do that as well by defining a listener rule so I'm going to say uh add a listener so we are going to say resource AWS underscore lb underscore listener so in this we need to Define this particular Target group should be attached to our load balancer or else even though load balance is created and Target Loop is created they are not actually attached they are not listening to each other right so if you have used the application load balancer again in a day 7 video if you have seen I've explained each and everything that we are doing right now theoretically and I've shown you using the AWS console we have created The Listener we have created the target group and we have seen how each of these associate with each other right and that's what Nasi is doing here yeah that's right so in here we need to define or what targeted should be attached to what a load balancer so we need to say load balancer is going to be the one that we created so I'm going to say AWS underscore lb.mileb.arn if you find that this is the load balancer and then we also need to Define what port and protocol so we also need to define a Target which is going to become later on so now let's say put and then I'm going to say protocol protocol is HTTP so I'm going to say http and in here I am going to define the default action which is forward or redirect uh or show a particular response so in here we need to Define when you go to that particular Target group what is your action is it a forward kind of action or a redirection or a particular response or an error something like this so I'm going to say now Target group uh Target group underscore Arn is going to be the Arn of this particular Target group that we have created so I'm going to say AWS underscore LP underscore Target group dot the name of the group which is dot PG dot Arn perfect along with this you also need to define the type as if so slowly what is the action so action is forward forward with traffic whenever you come here all right great we need to change uh the uh attach we used for the both Target groups I think we have used the same uh name yeah let's try to change that that's right if you use the same one you'll get an issue yes okay so this is actually ready we can also choose to get the output right in our get so let's try to get an output of the load balancer DNS name so I'm going to say load load balancer yes basically output is used to get some information printed on your terminal let's say uh or you want to see for example the load balancer is getting created through this project now and uh one thing is you can go to your AWS console figure out what is your load balancer IP or what is your load balancer DNS but in some organization you might not have access to the console right so what you can do is you can use this output you can create this output module here or you can also create a file called outputs dot TF and you can print all the things that you want and once this terraform execution is done it will print the load balancer DNS on the terminal so you can just use it that's right so when I run terraform validate I'm getting an error saying type of tags are not expected do you mean tax some need to remove this or I can also yeah so tags when you use tags always make sure you put a this is very very common I think most of us have that adding a equal to symbol here yeah so validate and then it should be ready it should show us that the configuration is valid another command to make sure your code is nice and actually formatted you can run data from fmt command to have everything and you can see all the equal to symbols and formatting is perfect yeah so now we are ready let's go and run the graph from plan command to see what is going to be created according to the change we have made so it is going to refresh State the state file is present here terraform.th State you can also choose to put it anywhere else in these uh in the remote screen but don't push it on GitHub never push it and get up so now it says five things to be added load balancer Target group all the resources that we have created now let's go and run it so terraform Target group and everything so if you go here in our control right now we don't have any Target groups uh which is attached to a load balancer this is the one which I have already so I'm going to delete them because I'm not learn Associates so delete the escalate perfect so now Target group is in creating state it's yeah this is the one which is created through terraform and it will it has to look look forward targets right now which are unused and they will come up health status will be there and will be attached to alert balance as well so we'll have to wait some time because yeah this takes time you have to be patient here uh when you are doing this sometimes it might take little more time in your setup than what we are seeing right now so be patient there uh depends upon the network depends upon sometimes it also depends upon AWS how much time it is taking so try to be patient there and uh wait till your load balancer is active State and also the health check of your target group is also healthy that means your target group can forward your request to the ec2 instances yeah that's right uh you need to make sure that it is all healthy if it is not healthy low balance I will not put the traffic on that exactly so these are all the common things that you need to already know before you do it in through terraform oils it will be very very complex so make sure you have a good knowledge of console and you understand how things are going on in the console then it would be easy for you to do through terraform through python uh through any other SDK perfect yeah meanwhile this is getting created now you might be wondering okay we have done this entire setup but how this is used by devops Engineers on day-to-day activities or in the day-to-day life right so this is a very common project that devops Engineers does in their day-to-day life for example what we have done here is we have created instances we deployed our applications or I mean in this case we just deployed a HTML page but usually you can consider that we have deployed a golang application or a python application and we are using a load balancer and we are allowing people from outside to access it now this can be Cloud Champs official website or this can be my official website we would have done in the same way right so we will deploy this official website in the public subnets if it is secure in your organization you might put it in a private subnet but when we are doing our portfolio building or when we are doing a requirement for a client uh who is okay with deploying instances in the public subnet then this project is about that you're looking for and I've seen many good user descripts as well which has all the different configuration not just the simple thing but many complex things uh and even if you see at this project we are not doing anything manually yes if we have a website it's all done automated through terraform but let's say you want to set up some complex things you can also integrate ansible with terraform which is a very very common use case right now so where you have one click Solution by running the rough apply everything is done automatically so you can see here we have our things ready let's go and check them in the console so you can see there are Target groups and both of them are healthy if I show you the load balances let's see if the role balancer is created or small so early we didn't have any now we have my lb and the state is active that is very very important yeah if it is not active it is in provisioning state you have to wait for some time so that it comes inactive or else you will not get the output so you can see this is what we added when we connected our Target group with our load balances which is also very important stuff if you don't have this you might not get the response so let's try to open this I am going to open my now the final step let's see if it is going to work or not so right now it is Welcome to Cloud champ if I refresh you should show me so we have everything set up through terraform which is very very uh amazing I say yeah if you do this manually it will take you more time if you want to do this hundred of time it will take you a lot of time so it's very good for you to do this through data from yes and if you complete this I am very very sure you'll learn a lot so yeah make sure you do this project yeah we both request uh all the subscribers who are watching this to try to do it by yourself by looking at the video take some time write down the steps what you need to do and try it at your end using visual studio code now let's say still you are finding it difficult we will put the code in the GitHub and I'll put the link of the description for the GitHub repository in the YouTube video right so you can also but before that try to do it but yourself yeah by the time you are saying this things I can go ahead and create a new approach awesome so that they can also select know which is set so I'm going to say terraform underscore AWS underscore project create infrastructure on AWS using terraform great and let's call this I'm going to edit the readme.md later on but let's push this wow now let's upload that folder and it is available for all of you yeah so this is the wrapper I'm going to put the link like I'll give the link to Abhishek and it's going to put that okay so so I'll do it later but this is the name if you want to get the code you can get it from here and focus and but please try to do it on your own before you use this as a reference so that you make sure you're understanding things properly yeah awesome so if you are following this do not do two things one is if you try to put this entire code in your GitHub as well do not push the state file and the second thing is once you're done with it definitely try to delete the load balancer and all the resources that we have created you can also use terraform destroy command yeah everything just show you that yeah because if you do it manually you might miss a thing or two so if you want to delete everything you just need to run Kara from destroy and hyphen Auto prompt if you want to or if you want to check what is going to be destroyed you can just run it but I'm going to use iPhone to iPhone proof and this will start destroying everything with that is defined here amazing how do you delete it because I don't want you to get charged positive yes so thank you so much Cloud champ for being here and walking us through all these steps very very patiently and I love this session it was a lot of fun and I hope all the subscribers viewers who are watching this video there is a lot to take back from this video definitely try it at your end and don't forget to subscribe to Cloud champ uh he is also doing great work with respect to all the devops Technologies tools up to date in the market so yeah any final word from you cloud very very it was an amazing time spending with you and learning all these things obviously a great pleasure to be here and thank you for having me on this channel letting me do this project for your audience uh obviously if you guys love this project let us know in the comment section feel free to share this on your LinkedIn do tag us so we can repost it we can comment at it uh so that we get to know that this project is actually helping you or not and this is very very nice project most of these things you might be asked in your interviews you might also do it in your uh in your job because this is kind of a bootstrap that we use for mainly all the different projects that we do even I get similar kind of uh projects that I when I do freelancing so if you're into someone who wants to do freelancing this can also help you like I got questions all the time like what is the project that you might get on freelancing so this is one of the similar kind of projects that you might get on freelancing as well oh wow that's great yeah so you can also to make some money with this video yeah that's good me personally I have made a lot of amount of video just learning load balancer and it's not terraformal balancer just the manual load balancer there are many companies who want to load balance and auto scale their sites so they don't know actually how to do it and they can give you money if you do it properly so learning a thing can also be it but don't learn in a way to earn things make sure you understand things and then money will follow yeah yeah so thank you so much do uh let us know in the comment section any feedback that you have uh with respect to this video see you all in the next one with more exciting content take care everyone bye bye foreign
Info
Channel: Abhishek.Veeramalla
Views: 59,189
Rating: undefined out of 5
Keywords: devops mock interview, devops, devops round table, azure, vmware, openshift, gcp, openstack, azure git, bitbucket, stash, gitlab, azure devops interview questions, Real Time Python Project, DevOps Python Project, python videos, what is devops, why devops, how to learn devops, SRE, What is SRE ?, Devops vs SRE, Devops to SRE, SRE roadmap, learn SRE, Platform Engineering ?, What is Platform Engineering ?, Difference Between Platform Engineering and DevOps ?, Future of Devops
Id: Koabqyopqns
Channel Id: undefined
Length: 87min 22sec (5242 seconds)
Published: Tue Aug 08 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.