How to Connect to Google Compute Engine Virtual Machine with SSH or puTTY on Mac

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys in this video i'm going to show you how to connect to your google cloud compute engine virtual machine locally using your terminal over ssh and the reason i think you should know this is because i've noticed that sometimes when i try to connect to my instance over ssh in the browser i get this long running spinner and i essentially get locked out for some period of time so if that ever happens to you being able to do this locally will be a good alternative to make sure that you can get into your vm instance anyways guys let's get started okay so let's go ahead and create our dummy vm all right ssh example region doesn't really matter the size doesn't really matter okay so we're going to go down to management security and these keys allow access only to this instance unlike project wide ssh keys let's go ahead and generate our key so i'm going to come over to terminal okay so we're going to copy this command here and run this locally and one thing we want to do is just swap out the name of the key so i'm going to call this gcloud ssh vm and then my username i'm going to put my email address that i use to access compute cloud i'm going to do no pass phrase okay so on a mac there is a directory called ssh and it basically holds all your keys just so when you're using keys i kind of know to look in one place so the key i just generated was this guy here so there's a there's a private and a public key so actually let's just open this up so we can take a look at it that is my private key all right so we're going to take this public key note there are a couple extra flags here this is just how the format that google wants it and we're going to put it into this field here we're going to go ahead and click create okay it looks like our vm is set up i'm going to connect in the browser real quick just to validate that everything looks good okay so now let's let's connect from our terminal using the ssh key that we just set up so there's a particular command here that we're going to want to use so say i was just in my root directory here i would throw this command in here so the first argument is path to private key we're going to do and then we're going to reference our private key which is this guy right here and then username and then the ip of the vm so it's going to prompt us here on the first connection we're just going to type yes and then we're going to run the same command and we can see we are in our server and just to validate that i'll do touch new file dot txt oops so i'm going to elevate myself and i'm going to go back to root maybe touch new file.txt and i should see that show up on this guy here there it is so now we're remotely connected to the vm if i wanted to get out i just click exit and now i'm not connected anymore or i can connect again you can just see how easy that is right not connected connected so there are benefits to this you don't have to go into google cloud platform every time you want to connect to your vm anyways guys that's all i got thanks if you like this video go ahead and click that like button and thanks for listening
Info
Channel: Data Slayer
Views: 14,378
Rating: undefined out of 5
Keywords: google cloud, gcp, ssh, google cloud platform, putty, compute engine, instance, ssh key generation, gcp ssh, gcp virtual machine ssh, gcp vm ssh, gcp ssh vm, ssh gcp, ssh gcp vm, google cloud console, create ssh instance, install git cloud, compute engine instance, git cloud, git google, google cloud terminal, google cloud ssh, google console ssh, google console git, virtual machine
Id: vA18jo-4gu4
Channel Id: undefined
Length: 4min 17sec (257 seconds)
Published: Mon Mar 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.