How to create Red Hat Linux EC2 in AWS and Connect to EC2 from local machine | Step by Step Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
everyone welcome back in this video we are going to learn how to provision a red hat ec2 instance in AWS Cloud let's say you are completely new to AWS Cloud you wanted to learn how to spin up a VM how to login into that VM and then how to you know like execute basic Linux command this is a good video for you all right so let's get started the prerequisite for this particular lab exercises you know you need to have AWS account setup if you don't have AWS account setup that's not a problem all you have to do is just go to Google and then just type AWS feeder account click on this particular link that will take you to this page and then you can go ahead and then sign up for your AWS free data account now let's say that you have created your AWS account and you logged into Daws console so this is how it's going to look like now let's say how to spin up a Red Hat Linux VM so all you have to do is click on ec2 here and then click on launch instance if you see here there are various Amis available for us here okay so we wanted to spin up a red hat so let's give some name here red hat ec2 and then click on red hat so AWS have created a bunch of Amis for us so AMA is nothing but it's a template which contains all your OS and then other supported applications in it so we just need to select the uh the tab here and then you can see here AWS have these three different templates under red hat so we wanted to spin up this particular one so we wanted to choose Linux 9 version as of August 3rd 2023 so that's the available version so let's select that one and then we wanted to choose the instance type so this is actually for how many CPUs you want and you know all this Computing so let's actually go with one CPU and then two gig okay so if you see here as a free tire this is the eligibility right so you can have for your filter account one CPU with one gig you will not be charged when you go with this a TL dot micro but again if you are setting up Jenkins or if you're setting up uh Tomcat or or you know a Nexus or artifactory you better need to have you know slightly more computing power so I'm going to go with the Twitter dot small which is one CPU and then two gig memory and then we have to select a key pair so this is like securely connecting to your ec2 instance from your local machine right so we need to create a keypad so let me create a new keypad so let me give something like maybe my red hat key so give a name for your key pair so don't give any space or don't give any special characters when you create a key pair and then rest everything you can leave it as as self it as it is and then click on create keypad there you go so now what this has done is you know this has downloaded uh you know this dot pump key or this pump key in my local machine okay and then if you want to open up any additional port numbers uh you know and then you can open up so click on edit so by default as you can see here port number 22 is open why because uh using this port number 22 you can securely connect from your local machine into this particular ec2 instance okay but if you wanted to open up additional port number you can click on ADD Security Group root and then you can open up let's say you wanted to set up Jenkins on this particular machine the Jenkins default port number is 8080 okay and then you can leave you know the sources you know zero all zeros okay I know this is not recommended but if you are interested in you know mentioning your local machine IP address feel free to mention the IP address as well okay or you can also select my IP and that's gonna you know find out your public IP address and then you can do that okay if you want you can also do that as well okay but I'm going to leave it anywhere okay perfect and then how much root volume you wanted right uh I don't think 10 gig is enough I'm going to maybe bump it up to maybe 15 gig so that's it right so now you can see in the summary section how many instances we are creating what is the Ami type what is our instance type and then the Security Group whatever the security firewall rules we have created right that's the name of the security group and then what is the storage volume right and that's it and click on launch instance this is there you go so our in instance is successfully launched so click on that instance ID now that will uh that will take us over here so right now it is in the process of coming up so while this is coming up if you actually see my website I also provided a small link here which talks about how you can connect to your ec2 instance from a local machine so as this is coming up why don't we just talk about it right so let's say this is you you have a laptop uh you have created this ec2 instance in AWS Cloud so how are you going to connect to it right so yes if you're using a laptop whether if you're using a Windows laptop or MacBook you need to have SSH client so you can use either git bash or you can use item or you can also use party as well you can use any any of SSH you know terminals in order to connect to your ec2 instance running in AWS Cloud since I'm actually running on MacBook I already have my item installed so I'm going to use this item to connect to ec2 instance running in AWS Cloud so how would you connect so let's go here and make sure this is in the running State and then click on this uh you know this check box and then click on connect now you're gonna see these four tabs click on SSH client and then click on this example right so basically we are going to connect using our SSH Keys which we just downloaded in our local machine generally this will be in our downloads directory and this is the name of the user and then this is the public uh DNS name for your ec2 instance okay so copy this one so type PWD so this tells you that this is the working directory right now so if you see here our keys got downloaded into the downloads directory so type CD downloads and then type PWD so now I am actually in the download directory and then if you are wondering about the key you can see whether the keys got downloaded here so you type LS minus Al and then mention the key name there you go you see here right so we downloaded this key like few seconds ago and as you can see here this has like read and write right so this should not have right access okay as per AWS recommendation here so what are they saying they are saying that run this command if necessary to ensure that the key is not publicly viewable so just copy this command change mod 400 execute that so and then you type LS minus L wow there you go you see here now this has only like a read-only access right perfect so that is good now let's go ahead and then copy the URL from here and then paste that over here now it is asking are you sure you want to continue connecting then type yes there you go now you see here so we are actually connected to our ec2 instant running in the AWS cloud and then this is the username right easy to username and you can see that here so that's the default username for our red hat ec2 instance so yeah so that's it guys you know that's how you would provision an ec2 instance and then connect to your ec2 instance from your local machine and then last but not the least so whenever you are doing your lab exercise or anything like that after you're done with the lab exercise it is also a good practice to stop your ec2 instance from running after you're done with the lab exercise why because you know if you keep them running you will be really charged so if you want to avoid uh being charged by AWS Cloud what you can do you can click on this one and then go to instant stage and then click on stop instance so when you do that so this will make sure that you know you will not be charged for your ec2 instance usage why because this is this is being stopped right or did it stopped already right so that is also a good practice all right so yeah so that's it guys uh that's how you would uh provision an ec2 instance in AWS cloud and then that's how you connect to that red hat easy to instance from your local machine thank you for watching this video
Info
Channel: DevOps Coach
Views: 1,142
Rating: undefined out of 5
Keywords: EC2 instance creation, How to create new EC2 instance in AWS cloud
Id: AXxmOvM6Tig
Channel Id: undefined
Length: 8min 55sec (535 seconds)
Published: Thu Aug 03 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.