1. Home
  2. Training Library
  3. Task Three | Google Cloud Platform: Part 1 | Introducing Google Cloud Platform

Task Three | Google Cloud Platform: Part 1 | Introducing Google Cloud Platform

Developed with
QA

Contents

keyboard_tab
Task Three | Google Cloud Platform: Part 1 | Introducing Google Cloud Platform
play-arrow
Introduction to the Google Cloud Platform - Getting started
Overview
DifficultyBeginner
Duration10m
Students105
Ratings
5/5
starstarstarstarstar

Description

This video will walk you through a detailed introduction to the Google Cloud Platform.

Transcript

Hi and welcome to CloudAcademy.com's video series on Google Cloud Platform, The Basics. In this video, we're going to dive right in and quickly launch our first GCE instance.

How to launch a Google Compute Engine instance 

You can access the Google Cloud Platform from cloud.google.com. From there, it's a quick link to go to my console and you'll see that everything is built around projects. I currently have one project called exploration. Any instances or other Google tools that you will enable and use in the future must belong to one project. You could create a new project if you like. In order to make the project active, you'll have to provide Google with billing information. So for now we'll just rely on the project we already have, again, called exploration.

The side column, which you can scroll up and down independently of the rest of the page, contains links to the various tools that are associated with this project. For us, we're interested in compute and let's click on VM instances. We'll spin up a VM fast by creating an instance. We'll rely on Google's intuition and call our instance Instance-1. We could add metadata to further identify the instance. But at this point, we don't have other instances running, we'll just leave that blank.

Google allows us to very easily set up a working firewall. We can choose to allow HTTP traffic or also HTTPS, which is secure HTTP traffic. Obviously, firewalls can be much more finely defined and configured elsewhere, but this is a very straightforward way to get started. Which geographic zone would we like this instance to work from? Let's just leave it as default for now.

But obviously, if we were creating a web service that would have users in a particular part of the world, say North America, we'd choose a North American site for our server. Which machine type would you like you use? This obviously will be determined by the intensity of the services and the use that this instance will be put to. If you're going to have thousands of users all heavily downloading video or data, you'll want a more robust system. For our purposes right now, an F1 micro will certainly do the job.

Add disks and standard networking to your instance 

What media would you like to use to act as a hard drive on this system? A new disc from image, that is, the Google Compute Engine will create a virtual disc based on a preset operating system image. You could also choose to reuse an image that you saved previously as a snapshot and loop quickly and efficiently from that image or you can attach an existing disc with all its data besides the operating system, but the data also, to this instance. For us right now though, the new disc from image will be fine. Which operating system image would we like to use? The latest version of Debian 7 Wheezy with its backboards is good for us. The disc type, we'll say for now will be a standard persistent disc.

The other choice is SSD persistent disc. Obviously an SSD disc will be a great deal faster. Of course the trade-off is to remain in the same price range, it'll probably be a lot smaller. But depending on the project and the service that you're providing, the choice of discs should be fairly clear. We'll stick with standard persistent disc for now.

Our network will be default because there are no other networks associated with our project right now. Now the external IP, which is the IP address through which anybody out in the Internet can reach us, will be ephemeral, meaning it will be dynamic. It will change each time the instance is booted and will disappear once the instance is shut down. We could choose a new static IP address, meaning the access to this instance will remain active through this IP address for as long as the instance exists, whether it's shut down in the meantime and restarted or whether it's been on all of the time. We could later actually convert our ephemeral address to a static address, which makes actually this decision a lot easier to make. So for now, we'll just leave it as ephemeral.

Let's create the instance. Let's remove this activity dialog to give us more space. We now see in the middle of the screen the instance name, Instance-1, seems to be up and running. It's in the Asia-East-1c zone. The disc associated with the instance is also called Instance-1, which could be a little confusing. We may want to change the name of that disc a little later just so we can be more clear about what we're looking at in a given menu. The network is default as we had set and the external IP is 130.211.255.28.

How to SSH your new instance and install Apache 

We may connect directly from the web interface just by clicking on SSH. The nice thing about using the browser window itself is that the key pairs have already been set up. Google doesn't require that we create a key pair, download it to our own computer, and then invoke the key pair from our own SSH session in our own console. Rather, it does it all invisibly. So let's just click on SSH and a shell session inside the new instance is created. We are the root user and we have without a password sudo powers. Remember though, this is Debian, not as some of you might be more familiar, Ubuntu. There are some subtle differences between Debian and Ubuntu command line, even though Debian and Ubuntu are closely related. For instance, if you want to display your network interfaces using ifconfig, in Debian, you'll have to use sudo to invoke the root authorities. Our interface, our main interface that we're interested in is eth0 and it's Inet Address, that is its IP address through which it connects to the outside world, is 10.240.128.254. Let's make sure that we have access to the outside world.

Let's ping gmail.com, let's say, and we're getting responses from gmail.com which teaches us two things. One is that we have access to the outside world and two, there's a DNS name server that's running somewhere, that translates the word gmail.com to the IP address of gmail.com. The IP address of gmail.com right now happens to be 174.125.23.18.

Now, let's make this instance useful. It's very nice that we have a shell and access to the shell, but it's not doing us any good right now. Let's run sudo apt-get update. This updated the repository information that's available to our instance. Once we know what we have access to, we can now safely download any software packages that we'll need, confident that we're getting the latest and most up-to-date package. So let's sudo apt-get install apache2, which will install the Apache Web Server version two. Type Y for yes, that we, in fact, want to download this extra data and install it. It seems to be done. Let's CD to /var/www, which is a directory that Apache creates, var is there by default in all Linux systems, but the /www is added when Apache is installed. It's there. It exists. LS to list the contents of www. There's an index.html file. Now let's paste the IP address that we previously took from the console when we created our instance and let's direct our browser to that address and we see the HTML page that was in var-var/www is accessible to users from anywhere on the Internet. So it works.