PAUL RASHIDI: Hello.
I'm Paul Rashidi with the Google Cloud Platform team.
Now that Compute Engine is open for everyone to use,
I thought it'd be 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/console.
When you first come to the cloud console,
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 creation process.
Now that the project's been created,
we'll have access to all of Google Cloud Platform's
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.
I'll go ahead and fill in my billing details
and be right back.
After we've entered our billing information,
we'll navigate to the Google Compute Engine Instances
page, where we'll see a list of virtual machines
that we've created.
We don't currently have any, so let's add one.
We're going to create an instance called Test Web
Server.
Start by clicking the New Instance button
at the top of the page.
We'll specify the name as Test Web Server.
For the zone, we'll select US Central 1B.
For machine type, since this is a test,
we'll select the smallest one available, the F1 micro
with one virtual CPU and just over a half a gig of RAM.
And we'll go with the suggested default image, which is Debian.
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.
So by default, Google Compute Engine
blocks all connections to an instance from the internet.
Since we want to serve web pages from our instance,
we'll 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'll do that by clicking Networks.
Select a default network, which is
where we created our virtual machine.
Click the new link that appears at the top of the firewall
section.
Name the firewall http1.
In the Protocol and Ports field, enter TCP 80.
Click the Create button to complete
the creation of the firewall.
Once this process completes, we should
see the new firewall appear in the firewalls list.
And there it is.
Now that the network where the virtual machine
instance resides has a firewall configured
to allow internet access, let's install a web server
on our virtual machine.
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, which
is included in the Google Cloud SDK.
The instructions for downloading and installing Google Cloud SDK
can be found at developer.google.com/cloud/SDK.
You'll essentially download it as a file,
extract it, and run an install script.
Then run an authentication script
and grant the tool access.
I'll go ahead and finish speeding through this process
now.
The authentication command here is
what grants the SDK access to work with your project.
An OAuth2 token is being issued and stored.
We're now set up to use gcutil.
Once gcutil is installed on our machine,
we can use it to remotely access the instance we created.
There's a quick way to do this if you
go to the Instance Details page.
On the side, there's an SSH link.
Copy the SSH command that's provided there.
Open a Terminal Window and paste the SSH command into it.
You're prompted for a pass phrase.
Enter something you can remember for SSH keys.
Here we are in the command line of our virtual machine
instance.
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.
We'll use that.
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.
Hit y and type 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 unloading that default web page in a web
browser to confirm that we're actually serving web pages.
So let's jump back to a browser to test
is we can load the default web page that Apache has created.
Now, to find our default page, we
need to know the internet address of our server.
We'll get that on the VM Instances
page of the Cloud Console.
We can see our external IP address here.
Open a new tab and type the IP address.
And here we have 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 start typing sudo to run the command as a super user,
then nano, which is a text editor we'll use,
and then the location of the Apache default web page,
which is var/www/index.html.
When we run that, it opens up the index.
file and the nano text editor.
We'll remove the default text that's there.
And then we'll paste in an image,
so that we can easily tell the page has been modified.
We'll save the page in nano by pressing the Command
key and the X key at the same time.
And then type y to save the file and close nano.
Back in the browser, we should be able to Refresh the page.
And there's 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 persistent disk we created.
As I do that, let's make a calculation
about how much this whole test cost.
So to delete the virtual machine and persistent disk,
first we'll select our test web server VM.
Then scroll down and click the Delete Disk Instance button.
We'll check the option for deleting the boot disk as well.
And then click OK.
Our 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
comes in at just under a third of a cent.
And there we go.
The virtual machine has just been deleted.
Now, back to pricing.
The persistent disk pricing is $0.04 per gigabyte per month.
So that roughly comes to just under half a cent
for a 500 gigabyte boot disk, the default.
So everything we just did on Compute Engine,
we did for less than $0.01.
Thanks for watching.
Now, it's your turn.
Go try creating your own cloud-based web server
on Compute Engine.