Skip to content

Latest commit

 

History

History
97 lines (81 loc) · 8.98 KB

File metadata and controls

97 lines (81 loc) · 8.98 KB

Create GCP Virtual Machine Instance

  • similar to AWS EC2 Instance

What will learn in this?

  1. Creating a GCP Ubuntu/Linux VM
  2. Will Connect to WinSCP (upload files from Local machine to VM) and then Connect To Putty
  3. Upload Portfolio program files to VM directory using WinSCP
  4. Will Connect to VM using Remote Desktop and will run portfolio app using Remote Desktop

First, Create a Project

  1. To create Project go to Menu > IAM & Admin > Manage Resources image
  2. Click on Create Project button image
  3. Give the Project name and click Next image
  4. Refresh, project will listed project created successfully image

Now, Create VM Instance

  1. Go to Menu > Compute Engine > VM Instances image
  2. Make sure Project name selecte top then click on Enable API if ask image
  3. Create VM Instance image

VM creation begin

  1. image
  2. image
  3. image
  4. image
  5. image
  6. image
  7. image
  8. image
  9. image

Connect VM Instance image

  1. Connect in Browser: Select first option in COnnect option after it will open new tabimage
    • run some basic commands to check image

Connect with Putty and WinSCP

To Connect with WinSCP we need to generate SSH private key first

  1. To generate SSH key install PuttyGen, download link https://puttygen.com/download.php?val=49
  2. Open PuttyGen and click on generate image
  3. While generating the key move mouse cursor anywhere until it get completed image
  4. Replace Key Comment value with the gmail id of that GCP account and enter passphrase and confirm like 12345, this passphrase required to connect WinSCPimage
  5. Now, save this key as once Public and once Private by clicking both Save Public key and Save Private Key (private key will be .ppk) image
  6. Now, Copy the entire generate key image
  7. Go to GCP VM instance Page under VM Instances click on Edit image
  8. Delete the existing keys and paste copied key and save it image
  9. After saving 'username as robinhud299' image
  10. Now, copy the External IP(Public IP), make sure instance is running else external ip will not visible image

Connect to WinSCP

  1. Launch WinSCP and Enter Hostname as External Ip and Username as robinhud299 as created above image
  2. Skip the Password field and click on Advance button then SSH > Authenticate and select the Private_key .ppk file saved earlier using Puttygen.image
  3. Click on Login and click Yes if ask anything image
  4. Now enter the passphrase 12345 same as enter while generating key image
  5. Yaahoooooooooo!!!! Connected... image

Connect Putty if alrady connected with WinSCP then just click on Open Session in Putty or Ctrl+P, it will ask passphrase enter the same

image

  • Try runnung some commands
  • image
  • image
  • image

Run First Application on GCP VM Instance

  1. Connect to WinSCP
  2. Connect to Putty (Ctrl+P in WinSCP)
  3. first update sudo by cmd sudo apt update
  4. check python installation or version run python3
  5. install python using sudo apt install python3.10
  6. install pip using sudo apt install python-pip
  7. unistall python2.7 sudo apt purge -y python2.7-minimal
  8. install pip sudo apt install python3-pip
  9. install packages from requirements.txt pip3 install -r requirements.txt
  10. Run python script python3 app.py

Let's Access GCP VM using Remote Desktop Connection

  1. Open VM terminal using Broser Shell or Putty

  2. Follow below commands to setup VM

    1. install XRDP, run sudo apt install xrdp
    2. enable xrdp, run sudo systemctl enable xrdp and then sudo add-apt-repository ppa:gnome3-team/gnome3
    3. COnfigure XRDP, run sudo apt-get install gnome-shell ubuntu-gnome-desktop
    4. set password for login to remote, run sudo passwd robinhud299 and then enter and confirm password
  3. Now, go to VM page and copy the Public/External IPimage

  4. Now, open Remote Desktop Connection in Windows machine and enter the same external ip and connect and confirm yes image image

  5. Now, it will ask for login credentials enter the username as robinhud299 and password as 12345 as earlier setup above and click ok image

Connected to Remote Desktop

image image image image image

Running Dash App in Remote Desktopimage