How To Create A GCP Compute Engine VM Instance Using PowerShell

How To Create A GCP Compute Engine VM Instance Using PowerShell

How To Create A GCP Compute Engine VM Instance Using PowerShell

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In this blog post, we will discuss how to create a GCP compute VM instance using PowerShell. We will create a new VM instance from scratch including network and firewall rule.

Prerequisites:

  • One Windows system with PowerShell.
  • PowerShell module for GCP installed and configured with proper access.

You can follow the below blog post to install and configure PowerShell for GCP.

https://cloudaffaire.com/how-to-install-and-configure-powershell-for-gcp/

How To Create A GCP Compute Engine VM Instance Using PowerShell:

Step 1: Create a new custom network.

Step 2: Create a new firewall rule for SSH connection in your custom GCP network.

Step 3: Get GCP image details for your VM instance. For this demo I am using CentOS 7 image, you can try any other image you like.

Step 4: Get your GCP VM instance machine type. For this demo, I will be using e2-micro which is free tire eligible.

Step 5: Create the new GCP compute engine VM instance.

Step 6: Connect to your new GCP compute engine VM instance using gcloud.

Note: I did not find any PowerShell cmdlet to configure ssh keys for GCP compute instance, hence using gcloud instead. If you are aware, kindly write in the comment section and I will update the blog accordingly.

Step 7: Cleanup.

Hope you have enjoyed this blog post. Please refer below GCP documentations for more details

https://cloud.google.com/tools/powershell/docs/create-manage

http://googlecloudplatform.github.io/google-cloud-powershell/#/

 

 

Leave a Reply

Close Menu