Hello, I'm Jonathan Simon with the Google Cloud Platform team.
I'm going to show you a demo of using Compute Engine to set up
a simple Cloud based web server.
That way you can see the process and then try it out
for yourself.
Let's get started by pointing a browser to cloud.Google.com.
Click to My Console link to view the developer's console.
Now that we're in the console, we'll create a new project.
We're creating a test web server,
so we'll call it Web Server Project.
We'll also change the suggested product ID.
Agree to the terms of service, and then click Create.
That'll start the project creation process.
Now, the project that's being created
will have access to all of Google's Cloud Platform
services.
Compute Engine is a paid service,
so the first thing we'll need to do
is set up our billing information.
You'll likely be surprised at how affordable experimenting
with Compute Engine can be.
After we've entered our billing information,
we'll navigate to the Compute Engine VM Instances
page, where we should see a list of the virtual machines
that we've created.
We don't currently have any, so let's add one.
Start by clicking the Create Instance button.
We'll specify the name as Test Web Server.
For the zone, we'll create our instance
in US central1 F. For the machine type, since this
is a test, we'll select the smallest one available-- The F1
micro, with just over half a gigabyte of memory.
And we'll go with the suggested default image, which is debian.
Next, click the Allow HTTP Traffic check
box, since this VM is going to be a web server.
All the other settings should be OK for our purposes,
so we can now click the Create button
to create the virtual machine.
Note that because we went with the default settings,
a 10 gigabyte persistent disk will be created, named
Test Web Server.
That will be used as the boot disk for the instance.
Persistent disks are especially useful,
because they can live on beyond a specific virtual machine's
lifetime.
This allows you to save the state of your virtual machine
at any point in time, and then restore it
at any time in the future.
Our instance is almost ready.
Some final health checks are being
run, which is the last step before the server is
ready to use.
There, now our instance has been created.
In order to make changes, like in selling software
on our Compute Engine virtual machine,
we'll need to remotely access the machine.
There's a quick way to do that right from the Instance Details
page.
Next to the VM's details, there's an SSH link.
Clicking that link will open a new browser
tab that contains a secure shell into the VM instance.
And there we go.
We've remotely accessed our test web server.
Here we are at the command line.
Well, let's install some software.
Specifically, some web server software.
The web server software we're going to install
is Apache Web Server.
A standard command used on Linux to install software is apt get.
So we're going to type sudo to run the command as super user,
apt get install Apache 2.
It's going to ask us to confirm that we want to install it.
Hit Y, and press Enter.
The installation process has started.
And now Apache has been installed.
As part of the installation process,
Apache creates a default web page.
We can try loading that default web
page in a browser to confirm that we are actually
serving web pages.
Back in the developer's console, we
can easily do this by clicking the external IP
address of the VM instance.
And there we go.
The default Apache page.
Great, our test web server is serving up web pages.
Now, to prove that this is our web server,
let's modify the default web page.
We'll jump back over to our SSH tab, and type
the following command to open up our default web
page in an editor.
We'll start by typing sudo, to run the command as superuser,
nano, which is the text editor we'll use,
and then the location of the default web page,
which is var/www/index.html.
When we run that, it opens the web page in an editor.
First, we'll remove the default text that's there.
And then we'll paste in an image so we can easily
tell that the page has been modified.
We'll save the page in nano by pressing
the Control key and X, and then Y
and Enter to close and save the file.
Back in the browser, we should be able to refresh the page.
And there is our new custom default web page.
Now, I would call this test a success.
The final thing we need to do to wrap up our test
is to delete the virtual machine and the persistent disk.
As I do that, let's make a calculation about how
much this whole test cost.
We'll select our test web server,
and click the Delete button to delete
the VM and its persistent disk.
Click the Delete button again to confirm.
The deletion process has started.
So, how much did it cost to run this demo?
The current virtual machine price for the type we used is
$0.80 per hour.
Compute Engine VM instances are built
at a minimum of 10 minutes, and we ran our server
for less than that.
So our virtual machine usage cost
comes in at under 2/10 of one cent.
Their persistent disk pricing is $0.04 per gigabyte per month.
So that comes to well under a cent for the default 10
gigabyte boot disk that we used.
So everything we just did on Compute Engine,
for less than one cent.
And there we go, the virtual machine and its persistent disk
have been deleted.
Thanks for watching.
Now it's your turn.
Go try creating your own cloud based web server
on Compute Engine.