Creating a VM instance using the web console

The web console will allow you to view all the available options when configuring a VM. This is probably the best way to get started with provisioning VMs on GCP:

  1. Start with the hamburger (three horizontal bars on the top left).
  2. Click on Compute, and then on VM instances.
  3. Click on Create a new instance. A form will pop up.
  4. Enter a name for your instance.
  1. Pick a Zone. Note that some zones are more expensive than others, probably based on the resources available in it. There are a number of factors that matter when deciding the right zone. For instance, if you expect most of your traffic to be from Asia, it's preferable to pick a zone in Asia.
  2. Choose a Machine type from the drop-down list. If you are not going to run something very computation-heavy, you can choose a micro instance that has one shared virtual CPU and very little memory. We will choose the same for the purpose of this tutorial as it is the most economical option in this case. The cost of the VM will depend on the machine type as well, if you recall our discussions from the previous section.
  3. By default, the instance has a 10 GB standard persistent disk. You can choose to change this, if you so desire, by clicking on the Change button. We are keeping the default since that’s the minimum requirement to keep Debian smoothly running.
As this is the root disk for the instance, we recommend the readers to stick with the default (Debian) as a lot of the examples later on rely on this being a Linux VM.
  1. Choose how you want to restrict your instance, such as whether or not it should have access to cloud APIs, or serves HTTPS traffic and so on. Since we would be using this instance to install applications (like Apache webserver) via internet which serve HTTP/HTTPS traffic. We'd recommend keeping both options checked. And it is also recommended to have access to complete GCP Cloud APIs in case we make this VM interact with other GCP provisions.

  2. Note the link that says management, disks, networking, and SSH keys. Clicking on this will give you advanced configuration options. But it is alright to keep them as default for now.

  3. Once you've made your design choices, click Create. The preceding screenshot shows a sample set of choices. The design creation will take a few minutes.

Once it's complete, you can SSH directly into the instance to set up the software you want on it. This can be done in several ways:

  • Directly through the browser by clicking on SSH
  • You can also use your Cloud Shell and the gcloud command within it to SSH to this instance

The command would go as follows:

      gcloud compute ssh [INSTANCE NAME]
  • You can connect from an SSH client on your local machine, such as a terminal window on Mac or Linux, or the PuTTY program in Windows.

If you choose Open in browser window, and if you have pop-ups blocked on your machine, you will find an error message to the top right of your browser. Once you enable pop-ups, the SSH client will open up in a new browser window.

You can tell it's your VM instance from the prompt that displays the name you'd given in step two. Run a few commands to see what software has been pre-installed, as shown in the following screenshot:

As this is a Linux machine, you can use Linux commands to install, download, or update. Run the exit command to quit the SSH window. On your VM instance details page, click on the VM name to get to the VM instance details page where you'll now be able to see a spike in the graph.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset