/
Creating and Connecting to a GCP instance
Creating and Connecting to a GCP instance
1. Create a key pair
Create your SSH key pair
ssh-keygen -t rsa -f keys\ubuntu-box -C ubuntu -b 2048
ubuntu is the default user for the ubuntu box (I’m sure this can be changed)
Here the key pair are being stored in a keys folder
Two parts of a key are generated, a public and a private key.
You can distribute the public key, but there should be one and only one copy of the private key, so this is kept on your machine
2. Create a GCP instance
Compute Engine / VM Instances / CREATE INSTANCE
Specify the instance details
Expand the security section
Select ADD ITEM
Paste into here the public key of the key pair
3. Connecting to the machine
Use the following command to connect to the machine
ssh -i <path to private key> <username>@<ip address>
So in the above example
ssh -i keys\ubuntu-box ubuntu@ww.xx.yy.zz