[0:00]Welcome to the AWS tutorial. So, in the last chapter, we were learning about EC2 instances. We learned how to create a Windows instance in the last chapter, and then we connected to Windows using an RDP client.
[0:17]So, in this chapter, let's see how to create a Linux instance. The process of creating both Windows and Linux instances is almost the same. After creating them, connecting is a bit different.
[0:30]In the case of Windows, we connected using an RDP client, right? You remember, don't you? We downloaded an RDP file, double-clicked it, entered the username and password, and that's how we did it, right?
[0:43]In the case of Linux, it's a bit different; we do it using SSH. So, let's see how to do that. We have logged into the AWS console using our admin privileges.
[0:58]Now, let's create one. Click on the 'Launch Instance' button under 'Instances'. When you click the button, you will reach this page, the 'Launch Instance' page. First, we need to give a name. This is similar to what we did in Windows.
[1:20]Let's give it the name '001'. Okay. When we come here, we had chosen Windows, but now we need to choose the 'Amazon Linux' option. After that, choose the default 'Amazon Linux 2023 AMI'. It is free tier eligible.
[1:34]You will see many things within Amazon, but not all AMIs are free tier eligible. So, just ensure that the default 'Amazon Linux 2023' which is free tier eligible, is chosen. Okay.
[1:56]We choose 'X64 64-bit' itself and don't change anything here. The instance type already has a free tier eligible instance type, 't2.micro', which we choose. No difference here. Now, we are creating a new key-value pair for connecting to Linux. It's like a security credential, a private-public certificate.
[2:25]Okay. So, we create it. When creating, we give it a name, say, 'web server 001 keypair'. You can keep everything else as it is, 'pem' itself, RSA. Then, we click 'Create'. Okay. After creating, a new item will appear here, a key-value pair, downloaded. Okay. That 'pem' file is needed; keep it there. After that, there are no changes in the network settings.
[2:57]As discussed, he will create a new security group, called 'Launch Wizard 3'. You can check all that as it is. As we discussed earlier, we did not check these two things when creating Windows because we did not need to host a web server or anything like that in Windows, right?
[3:43]HTTP traffic and HTTPS traffic are mainly needed when hosting a web server. So, in this case, we are creating a Linux instance and then connecting. Then, in the next video, we are also trying to host a web server using the same instance.
[4:03]That's why, when creating this instance, you should also check this option, 'Allow HTTP traffic'. You need this for SSH to connect. After that, we are going to host a web server using this instance itself in the next video.
[4:28]That's why we have given this checkbox. You just need to check it. Okay. After that, it's our EBS volume. You might have noticed that when creating Windows, we got a default of 30 GB.
[4:40]But now it's 8 GB. The default is 8 GB. That's because Windows OS is a bit heavier. So, with its AMI, the files take up a bit more space on the hard disk.
[4:54]But Linux is a bit lightweight. So, 8 GB is enough for it. That's why it has chosen 8 GB by default. Okay. We already discussed that we have 30 GB of total EBS volume available in the free tier.
[5:11]That's how it is kept. I haven't made any changes there. The only change I made was to check this 'Allow HTTP' option. That's because we are hosting a web server in the next video, which is why we checked this. Okay.
[5:27]After that, we don't need to change anything else. There are many things under advanced settings. You don't need to worry about them now. We can learn them one by one. Okay.
[5:38]I haven't changed anything here. After that, we can click on 'Launch Instance'. So, what will it do? It will create an EC2 instance. That is, it is now creating a virtual computer that we can use within the AWS cloud. Okay.
[6:00]All of these are the same as when we created Windows and Linux, almost all of them are the same, right? Now, the difference is coming. We go to the instance. If you don't see it here, there's a refresh button at the top, right?
[6:08]Click it, and this page will refresh. After refreshing, we can see that our new Linux instance has been created, and its state is 'running'. That means it is working. Okay.
[6:26]Now, what do we need to do? We need to connect to this Linux EC2 instance that we created and perform operations within it, right? This is where the difference between Windows and Linux comes in.
[6:43]Windows normally connects using RDP clients and such. But Linux normally connects using things like SSH, right? So, we are going to connect to our Linux EC2 instance using the SSH utility. Okay.
[7:05]When connecting with SSH, we first open the command prompt. I am connecting to Linux from within a Windows machine. This is a Windows machine. So, I open the command prompt.
[7:12]After opening the command prompt, to check if SSH is working, you can type 'ssh'. If you get an output like this, it means SSH is properly working. Okay, now let's connect Windows with our instance.
[7:35]To connect, what you need to do is... I'll enlarge this. Okay. To connect, we need the command 'ssh', then the option '-i'. After that, we need our credential. We need to prove our identity, right?
[8:14]We had downloaded a 'pem' file when we created the key-value pair, right? That is this file. So, we need to give the path of this file. So, if you are on a Windows machine, press the 'Shift' key, then right-click, and you will get the 'Copy as path' option. So, we copy its path. It's just the process of copying the path of that file. Okay.
[8:45]That's the next option we need to give. Okay. So, we gave our certificate file there. Now, what we need to give is the username of our created EC2 instance and then the IP address, right?
[9:05]Normally, to connect to any computer on the internet, we use its IP address, right? That's common internet knowledge. I won't go into detail. In case you are missing that knowledge, just Google how the internet works and learn that. Normally, to connect to a computer via the internet, we use an IP address.
[9:24]So, every computer has an IP address. Our virtual computer that we created also has an IP address. So, we are going to connect to our virtual computer using that IP address over the internet, right?
[9:48]So, when accessing it, every computer is like having an email address. Every computer also has an IP address like this. So, we tell it that we are going to this computer using that IP address. So, here we need to give the IP address of the EC2 instance that we created. So, how do we get that?
[10:10]You need to choose the EC2 instance you want to connect to. After choosing it, all its details will appear below. Among those details, there is a 'Public IPv4 address' option here. There is also another option called 'Private IPv4 address'. This is for communication within AWS itself, and it won't work over the internet. It's private. Okay.
[10:34]We will discuss what that is in detail later. For now, you need to copy the public IPv4 address. Please note that if you copy the private IPv4 address, you won't get it. You need to copy the public one. Okay.
[10:46]There's an easy way to copy it here. You see a square here, right? If you click it, it will be copied. Okay. Now that we have copied it, we need to go back to our SSH. Then, before giving the IP address, we need to give a username, right?
[11:13]So, to prove our identity, we have already given the 'pem' file here, meaning no password is needed. But we need to say which user it is. So, last time when we created Windows, AWS itself created a username for us by default, right?
[11:41]Or, within the AMI of the Windows we chose, there was a default username already configured, which was the 'Administrator' user, right? You might remember that we logged in using the RDP client and the username 'Administrator'. But in the case of Linux, the username created by default is not 'Administrator', but rather 'ec2-user'. So, 'ec2-user' is the user. So, there are different usernames for different distributions of Linux. So, here, on the AWS website itself, in the documentation itself, they have mentioned what the default username will be for each distribution in the case of each user, right?
[12:23]If the user is not created by default, what happens? We won't be able to log in. That's why he creates a user by default. What we created here is an Amazon Linux instance. Its default username is 'ec2-user'. So, we need to give this 'ec2-user' in our SSH. Okay.
[12:47]After that, we need an 'at' symbol, and then our public IPv4 address that we copied earlier. Okay. You remember, right? The thing copied from here. That's what I've given here. After giving all this, we can hit Enter. After hitting Enter, it will ask for this thing. Give 'yes'. It's our own instance. It's okay. Give 'yes'. After giving 'yes', it will properly connect with our Linux here. Okay.
[13:32]Now, if we want, we can create a test folder, for example, and check if it's proper. We created a directory, and then we give the 'ls' command. It has been properly created, right? So, we have connected to our Linux and properly communicated with it, and all the operations are working. Okay.
[13:56]That's all for creating and connecting a Linux EC2 instance. It's very simple. We do it very simply, just like we created Windows. Now, we can do any operations we want within Linux. So, you don't delete this instance. Let it remain there.
[14:10]We will do a small hands-on in the next video, where we host a web server using this instance itself, and access that web server from outside over the internet. So, that's what we are going to do in the next video using this instance itself.
[14:31]That's why we checked the HTTP option in our security group. You must check it when creating Linux. That's because we are doing a web server in the next one. So, I think we can stop this video here. So, you just create this Linux and try to connect to it. Only by doing will we learn things.
[14:54]Now, one more thing. One more thing. We created a new instance just now. We had also created a Windows instance in the last video. So, you should do one thing. There's a limit for this free tier; it will only run for 750 hours.
[15:12]So, if you run two instances at the same time, your free tier limit will be exhausted after one month, and you will get a bill, and money will be spent. Okay.
[15:24]So, one thing you can do is to delete the Windows instance that we created earlier. Actually, it's enough to stop it. I went to another region to show you how to delete it. I haven't deleted the Linux instance that we just created. Let it remain there.
[15:52]Because that's where we are going to host a web server in the next video. So, let that remain there. But if you have created a Windows instance in the last video, it would be better to delete it. That's because one thing is, if you stop it, you won't be charged for the instance. It says 'stopped', right? That means this instance is shut down. That is, it is not running now. If it's not running, you won't be charged for that instance, but there's still a charge. That is for the EBS volume.
[16:17]That is, for storage. I hope you can understand that term, 'storage'. We discussed all those terminologies. So, for the EBS volume, we only have 30 GB in the free tier. When we created the Windows instance last time, Windows was a bit heavier, so we would have created it with 30 GB, right?
[16:44]And this 8 GB that we created for Linux now, all of this together might get exhausted, and there's a possibility that it will get exhausted monthly. So, what you can do is, if you have a Windows instance, we can completely delete it. To delete it, you select it. After selecting it, there's an option here called 'Terminate'. We already learned 'Stop' and 'Start', right?
[17:10]Start means it's like turning on your computer. It's a command to turn on our EC2 instance. Stop means it's like shutting down our computer. It's an option to shut down. Even after shutting down, the contents within the EBS volume won't be lost. They shouldn't be lost, right? Because next time when we start, the contents we created previously should be there, right?
[17:37]The files we created. So, the storage should be there. So, it won't do anything to the EBS volume. It will keep it there. And because it keeps it there, we will be charged. Okay. So, we don't need to keep it. We can completely delete the instance itself. That is, it's like selling our laptop, a real-life example of our computer.
[17:56]It's an option like you sell everything. You delete everything. If you created any files in storage, all of them will be gone. All of them. When you stop here, if you created a file, the storage won't be lost. It will remain there. If we shut down the computer and start it again, our storage will still be there, right? The same way. But if you terminate, we are completely abandoning our laptop, an option like that. You can't bring it back now. Everything will be lost. That's what it means. So, we don't need the Windows EC2 instance here, so we completely delete it. Okay.
[18:36]It will show something like this: 'On an EBS-backed instance, the default action is for the root EBS volume to be deleted when the instance is terminated. Storage on any local drives will be lost.' That is, it's an information saying that the EBS volume will be deleted. That is, 'storage on', we can figure it out, right? That is, we are completely deleting it. We are abandoning our computer. So, any files within it, any hard disk drive, whatever we keep, will be lost. That's the information it shows there. Okay. We are fine with that. So, we terminate. We click the 'Terminate' option. So, like everything else, 'initiated termination' is what it says. That is, it says 'shutting down' here. After a while, it will be gone. It will take some time. You can keep it there. It says 'terminated'. Okay.
[19:15]It's terminated. Now, the entry will still be here. The entry will be deleted after some time. Okay. That's all. If we do only that much, our computer is completely gone. Now, we don't have any charges. Now, only one instance is active in our account, which is the Linux instance. Let it remain there. We need to host a web server within that instance in the next video. So, let that remain there. So, I think we can close this video here. So, see you in the next video. Bye.



