Skip to content

Latest commit

 

History

History
147 lines (98 loc) · 5.49 KB

compute_short_quickstart-en.md

File metadata and controls

147 lines (98 loc) · 5.49 KB

Compute Engine Quickstart

Introduction

This tutorial explains how to create a Linux virtual machine instance in Compute Engine using the Google Cloud Platform Console.

Project setup

Google Cloud Platform organizes resources into projects. This allows you to collect all the related resources for a single application in one place.

Navigate to Compute Engine

Open the menu on the left side of the console.

Then, select the Compute Engine section.

Create a virtual machine instance

Click the Create instance button.

  • Select a name and zone for this instance.

  • In the Firewall selector, select Allow HTTP traffic. This opens port 80 (HTTP) to access the app.

  • Click the Create button to create the instance.

Note: Once the instance is created your billing account will start being charged according to the GCE pricing. You will remove the instance later to avoid extra charges.

VM instances page

While the instance is being created take your time to explore the VM instances page.

  • At the bottom you can see the list of your VMs
  • At the top you can see a control panel allowing you to
    • Create a new VM instance or an instance group
    • Start, stop, reset and delete instances

Connect to your instance

When the VM instance is created, you'll run a web server on the virtual machine.

The SSH buttons in the table will open up an SSH session to your instance in a separate window.

For this tutorial you will connect using Cloud Shell. Cloud Shell is a built-in command line tool for the console.

Open the Cloud Shell

Open Cloud Shell by clicking icon in the navigation bar at the top of the console.

Wait for the instance creation to finish

The instance creation needs to finish before the tutorial can proceed. The activity can be tracked by clicking the notification menu from the navigation bar at the top.

Connect to the instance

Enter the following command to SSH into the VM. If this is your first time using SSH from Cloud Shell, you will need to create a private key. Enter the zone and name of the instance you created.

gcloud compute --project "{{project-id}}" ssh --zone <vm-zone> <vm-name>

Run a simple web server

Create a simple index.html file with the following command:

echo "<h1>Hello World!</h1>" > index.html

Then, enter this command to run a simple Python webserver:

sudo python -m SimpleHTTPServer 80

Visit your application

Visit your webserver at the IP address listed in the External IP column.

Cleanup

To remove your instance, select the checkbox next to your instance name and click the Delete button.

Conclusion

You're done!

Here's what you can do next: