JONATHAN SIMON: Hello, I'm Johnson Simon with the Google
Compute Engine team.
Now that Compute Engine is open for everyone to use, I
thought it would fun to do a demo of using Compute Engine
to set up a 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.
When you first come to the cloud platform, you'll be
prompted to create a new project.
We're creating a test web server.
So we'll call it Web Server Project.
We'll change the suggested project ID as well, and then
click Create.
That will start the project creation process.
Now the project that's being created will have access to
all of Google's Cloud Platform services.
We're interested in Compute Engine for this demo.
So when the project creation process completes, we'll
select the Compute Engine service.
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 be
redirected to the Compute Engine 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 New Instance button at
the top of the page.
For the name of the instance, we'll specify Test Web Server.
We'll create the instance in the US Central 1A zone.
For the machine type, since this is a test, we will select
the F1 micro with one CPU and 0.6 gigabytes of memory.
We'll leave the boot source as new persistent disk from
image, and we'll go with the Debian image,
which is the default.
All the other settings should be OK, so we can click the
Create button to create our instance.
Because we specified the boot source as New Persistent Disk
from Image, a default 10 gigabyte persistent disk will
be created, named Boot 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 a specific 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, and
it's ready for use.
By default, all external traffic to
our instance is blocked.
Since we want to serve web pages with our instance, we
need to set up a firewall to specify that incoming HTTP
traffic is allowed on the network where our
newly-created virtual machine resides.
We can do that by clicking Networks and choosing the
default network where our instance was created and then
scrolling down to the Firewall section and click Create New.
The name of the firewall that we will create is HTTP1.
And under the Protocols and Ports
section, we'll enter TCP:80.
Then we'll click the Create link to create the firewall.
There.
The firewall creation process has started.
Once this process completes, we should see the new firewall
appear in the Firewalls list.
And there it is.
In order to make changes, like installing software on our
Compute Engine virtual machine, we need to remotely
access the machine.
The Google Compute Engine team has created a great tool for
doing this called gcutil.
Gcutil is a command line tool for interacting with Google
Compute Engine.
The instructions for downloading and installing
gcutil can be found at developers.googl
e.com/compute/docs/gcutil.
Once we've got gcutil installed on our machine, we
can use it to remotely access the instance we created.
There's a quick way to do that if you go to the Instance
Details page for our test web server, and then scroll down
to the bottom where you'll see an SSH link.
Click that link, and then copy the command
that's provided there.
Now, we're going to open a terminal window and paste that
command and run it.
And there we go.
We've remotely accessed our test web server.
Here we are on 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.
A standard command used on Linux to
install software is apt-get.
So we're going to type SUDO to run the command as a super
user, apt-get, install, Apache2.
It's going to ask us to confirm that we want to
install it.
Type y and hit Enter, and 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're actually serving web pages.
So let's jump back to a browser to test if we can load
the default web page that Apache has created.
Now, to find our default page so that we can try to load it
in a browser, we need to know the internet address of our
test web server.
We can find that back on the Instance Details page.
Locate the external IP address, and copy the value
you see provided there.
And open a browser tab, and paste the value that you just
copied, and hit Enter.
There we go, the default Apache web page.
Great, our test web server is serving up pages.
Now, to prove that this is our web server, let's modify the
default web page.
We'll jump back over to our terminal window and type the
following command to open up our default web
page in a text editor.
We'll start by typing SUDO to run the command as super user,
and then Nano, which is the text editor that we'll use,
and then the location of the Apache default web page, which
is /var/www/index.html.
When we run that, it will open up the index.html in the Nano
text editor.
First, we will remove the default text that's there.
And then we'll paste in an image, so that we can easily
tell that the page has been modified.
The final thing to do is to press the control and x keys
and then type y to save the file and close Nano.
Now, we should be able to go back to our browser and reload
the web page.
And there is our new custom default web page.
This is an image that was created at Google I/O as part
of the code lab that we ran called Computing the Cosmos.
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 we created and
the persistent disk.
As I do that, let's make a calculation about how much
this whole test costs.
We'll start by deleting the virtual machine.
And the deletion process has started.
The current virtual machine price for the type we use is
1.9 cents per hour.
We ran our server for around 10 minutes, so our virtual
machine usage cost 0.32 cents.
And there we go.
The virtual machine has been deleted.
Next, we'll delete the persistent disk.
The current persistent disk price for 10 gigabytes is $1
per month, plus a fee for I/O operations.
So our 10 minute usage costs roughly 0.002 cents.
The networking cost associated with our tests are even less.
So everything we just did on Compute Engine for
less than one cent.
Thanks for watching.
Now it's your turn.
Go try creating your own cloud-based web server on
Compute Engine.