SSH to EC2 Instances using Windows 10 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so if you are on windows 10 or a very new version of windows then you may be able to use the ssh command instead of using putty to log on to your ec2 instance so i have a windows 10 right here and i want to show you how we can do it so if you go to powershell for example and you type ssh and then you get this command back the usage of ssh and a lot of options that means that you have access to ssh if you don't have powershell you just have the command line editor and you type ssh you see the exact same thing that means that you have ssh if you see ssh command not found that means that you don't have ssh installed on your windows and that means that you will have to use putty as we saw in the previous lecture to connect to your ec2 instance but say you have the ssh command then we can do the exact same command as what we do on a linux or a mac computer to log on to our ec2 instance so what we have to do is do ssh minus i and i stands for identity file so we need to provide the location of our identity file for me this is my ec2 tutorial.pem file and i'm just going to copy the entire location so the location right here is copied and now paste it here and then i'll add the ec2 tutorial.pem okay next we have to decide what user we are going to use to connect to our ec2 instance so if we go back to our ec2 instance we launched an amazon linux 2 ami so the easy the user to log on to the ec2 machine is always ec2 user that is something you have to do when you when you use amazon linux this is why we have ec2 user in here and then at which corresponds to the ip of the machine so here we go to the public ipv4 and you'll copy it and remember that this ip will change if you restart your machine start and stop so we'll just paste this here and here we go so now i've done ssh minus i the whole path to the pem file and then the ec2 user because we use amazon x2 at the ip of our machine let's press enter and we're prompted with the fact that we want to verify the authenticity of the host because we're never connected to it before the windows need to know that we can trust this host so i'm just going to say yes and press enter and now i get an error warning unprotected private key file so you may or may not get it but it's important that if you get it you know how to resolve it so this is the same problem that we have when we have a linux or a mac we want the private key file so the pem file to be protected correctly and to have the correct permissions and so how do we fix this analytics a mac we use a common conch mod but for windows this chmod command does not exist therefore we need to use something else so i'm going to clear the screen and we'll have the command ready already but i'm going to go to my pem file so right here in my downloads right click and click on properties and then i'm going to go to security and in here we can see who has access to this key but in there there's an advanced tab so click on advanced and you are getting into the advanced security setting so the first thing you have to do is make sure that the owner of this key is yourself so i'm going to go here and i'm going to look for stefan and check the names and here i am i make myself an owner of this key so the owner has to be you and then you should remove any other uh other user so this one i can't remove and this one i can't remove is what as well because it has inheritance so i need to disable inheritance right here and i said okay convert inherited permissions to explicit permissions and now i can remove the system and i can remove the administrator so here now this file is tutorial pm has inheritance disabled and only me is able to control this file so i'll click on apply and then i have said okay now in here i need to make sure i have full control so yes i do have full control this is perfect and if i didn't i could click on permissions and then add myself to full control so now we have done something that's so that the properties of the security file is just us having full control over this file so that's perfect and now if we try this command again and press enter we are logged on to our amazon linux2 ec2 instance and the reason it worked now is that we had the right permission for security and we were not prompted with a yes no question because we already told windows to trust this ec2 instance and this ip so this is really cool now what i can do is show you that it works exactly on the command line so i go to the command line and paste the command oops let me do it again i'm going to the command line copy this and paste this press enter and again it will work right away again no yes no question to enter the instance because windows already trust that instance and no security error because we had fixed the security for this downloads so now you've seen how to do it on windows using ssh command hopefully that covers all the use cases you may have and all the issues you may encounter and you have to remember that you can only do this on windows 10 on mac or linux but if you have an older version of windows you cannot install ssh on it you have to use apathy as we saw in the previous lecture to log on to your ec2 instance backed by amazon linux 2. so that's it for this lecture i hope you enjoyed it hope that was really helpful and i will see you in the next lecture you
Info
Channel: Stephane Maarek
Views: 33,467
Rating: undefined out of 5
Keywords: Udemy, AWS, Amazon Web Services, Stephane Maarek, Learn, Tutorial, IT, Amazon Cloud, SSH, Secure Shell, CLI, EC2, Key pairs, Security groups, Windows 10
Id: kzLRxVgos2M
Channel Id: undefined
Length: 5min 28sec (328 seconds)
Published: Thu Apr 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.