Provisioning your first GCE instance
Google Compute Engine is the cornerstone of the Google Cloud Platform. It is an IaaS (Infrastructure as a Service) environment - powered by KVM hypervisors - that allows you to create instances based on default images and custom snapshots, with complete control over network traffic.
This course, crafted by our expert Linux System Administrator David Clinton, will help you get started with Google Compute Engine, either through Google's browser console or their command line interface. By the end of this course you will have everything it takes to master the efficient and effective use of GCE.
Who should take this course
As a beginner-level course, you don't need experience with Google Cloud Platform to benefit from this tutorial. Some basic knowledge of the Linux CLI interface and TCP/IP stack might help you better understand the Networking and the CLI lectures though.
If you need a high-level introduction to the cloud, check out the Introduction to Cloud Computing course. We also have an Introduction to Google Cloud Platform course to offer you broader overview of the whole family of Google services.
If, after going through this course, you'd like to test your knowledge of Google Compute Engine and improve your CloudRank, we've got Quizzes that should serve as a perfect followup.
Hi, and welcome to CloudAcademy.com's video series on getting started with the Google Compute Engine. In this video, although we have briefly discussed this in the Google Cloud Platform Introductory Series we'll look in greater detail at some of the more advanced options available when you launch a new instance.
How to launch a new Google Compute Engine instance
From our project window, we'll click on the project we'd like this instance to launch into and that's in our case the project called "Exploration." I'll remind you though that exploration is really never a designation that you'll use in identifying this project to various Google services. You'll use either the project ID which is Future Graph 718 in our case or the project number. The designation exploration is really only there to remind you of your own personal association with this project. Let's click on "Compute" and then "VM Instances." VM stands of course for Virtual Machine.
We'll create a new instance. And why not we'll call it "Instance One." However, we will have all the advanced options visible. We could change that by hiding advanced options but of course, we want them all visible so we will again show advanced options. So you could assign some method data a key and its value to this instance and in many cases especially if you have a lot of different services running in a project it's a very good idea to assign it metadata.
You could as we said in the introductory video set the instance to allow HTTP traffic, or only HTTPS traffic, or none at all. In our case, we're not actually going to be using this instance to do anything at all. We'll leave it with no automatic access at all. To more finely tune the firewall rules to allow access into and out of your instance, of course you can work with network settings either now in the introductory stage or later once the instance is actually up and running. You could if you'd like to access this instance directly from your own computer assign your own SSH keys to the instance. You could also add a description of the instance, which again would make it not only easily identifiable but have its purpose more readily available to people like you looking at the instance from somewhere else in your project.
You could add individual words or phrases as tags through which you could search for and quickly identify your instance so let's say we add the tag "web-server" so if you ever searched through all your hundreds of instances for a web server this is one of the instances that would come up. You should set the geographic zone in which this instance will be launched. By default right now, it happens to be asia-east1-c.
Obviously you can choose any of the other regions that are available and the choice you make will have a rather large impact on the resources you can access from this instance and access to your instances resources from the outside. Choosing a machine type requires some planning. If we drop down the menu, we'll see there's a large range of machine types. So for instance, a high CPU machine type would have one virtual core for every 0.9 gigabytes of RAM. A high memory type would have 6.5 gigabytes of RAM for every virtual core. We'll choose f1-micro just because it happens to be the smallest and cheapest instance available.
Attach disks to your instance
You must select a boot disk. There are three types of disks you can choose from, a new disk from an image that is a brand new disk, which has preinstalled on it an operating system image. You could choose a new disk from snapshot that is a new disk that will have installed on it a previously saved image that you created. It could be there was an instance you were running that you would like to reproduce in other instances. You could now add that snapshot to a new disk or you could use an existing disk, which not only will have the operating system and the configurations but will actually have all the data that was saved to it through the course of its life until now. We're going to select a new disk from image and we'll select an operating system. Let's say debian-7 with all the backports.
Boot disk type you can choose between the standard persistent disk or an SSD persistent disk. You obviously get much higher performance from the SSD but it's more expensive. One of the nice things about virtualization is that you can change your mind later. So for instance, now while we're just experimenting and playing around with our configuration, we can choose the less expensive standard persistent disk. And if we eventually are happy with what we've done and we'd like to actually deploy this instance in a production environment we could always upgrade to an SSD persistent disk later. We could also add a new disk. Just like on your own computers, you might have more than one disk drive in order to partition data into different categories sometimes for security reasons and sometimes just for added performance. You can do that just as easily if not easier in a virtualized environment. We'll leave it with one disk for now though.
Google Compute Engine Networking
Networking we have a choice between the default network that is the subnet addresses that your instance is given will be those that are chosen as default by Google or you could select an existing network with its range of subnet addresses if those suit your purposes better. Why would you care? Well, if you want to be able to communicate between one instance and another, you must be within the same network range. On the other hand, there are times when you want to isolate one instance from other instances so you'll specifically want them to be on a different non-overlapping subnet range and this can be managed by choosing a network.
Your external IP that is the IP address through which all other devices on the internet will reach you could be epherneral that is an IP address that will change every time you reboot the instance or it could be a static IP address. We'll just leave it as epherneral for now.
Available policies determine how your instance will behave when unusual things occur. Will, for instance, the instance automatically restart if it was terminated for some external, uncontrollable reasons? Usually and by default, Google assumes you'll want that enabled. You'll want automatic restarts. So if it shuts down for some reason because the hardware server it was hosted on crashes, you'd like it to restart as soon as possible.
Sometimes however you may have some services running on your instance that can only really be started up with somebody watching and manually controlling so you may want to disable this option, disable automatic restarts. Similarly you have the option of migrating a virtual machine instance, which is default and recommended from one hardware host to another if that becomes necessary or perhaps you might have some configuration issues that are too closely connected with one hardware host. You may want to migrate only manually only under your control. Again, it's your choice.
Project Access allows you to make use of a service account to enable seamless access between your instance and other Google resources. You have the option of setting these connections one by one. Now we'll create this instance. Let's make this little box disappear and let's SSH into our new instance. And we seem to be up and running.
About the Author
David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.
Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.
Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.
His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.