Google Compute Engine – Ten Minute Test Drive: Set Up your own Web Server
- Articles, Blog

Google Compute Engine – Ten Minute Test Drive: Set Up your own Web Server


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.

About Bill McCormick

Read All Posts By Bill McCormick

33 thoughts on “Google Compute Engine – Ten Minute Test Drive: Set Up your own Web Server

  1. Nope. I rent a server from a provider in Florida for 190mo. It has 8 cores, 8 GB of ram, 300GB Raid 5 storage, and 10TB of transfer. The same service from Google (from the first page searching google for "google compute engine cost" and a google page) would cost 470 per month for the n1 highcpu 8 d (although it has more storage) plus 1830 for transfers. Of course for "persistent disk" you need to add another 30 plus IO which I have no idea on. So.. 190 vs 2330 or 12.264x more

  2. The price is too granular. It makes it hard when it comes to pitching to marketers. They want a fixed fee. This is one of the reasons for which I charge people more – always better to overestimate.
    Until I require more processing power, I'll stick to Linode.

  3. True not everyone will need it, but it wouldn't cause an issue for those who didn't want it, and I suspect the majority of people hosting on compute engine are going the web server route.

  4. Step by step How to make $1,000 in 4 days
    Watch video Go here MAKEMONEYATHOME.COMYR.COM
    Hit Thumbs up if Helped you can find ALL THE SUPPORT..advice, guidance,tips..needed to succeed watch free video MAKEMONEYATHOME.COMYR.COM

  5. yep i agree, i couldn't believe it when my friend told me about this site. Listen, my spouse is getting paid monthly for doing some surveys and browsing sites. you can get it from here:RNMONEAEYATHOME.HOSTEI.COM

  6. If there's one thing that separates winners from losers it's action-taking Hours upon hours of step by step videos, manuals and process maps guide them through literally everything, down to the smallest detail from picking a product, keywords, installing the site, what exactly to write in just about every sentence… literally everything.ALL THE SUPPORT..advice, guidance,tips..needed to succeed.Everything you'll need to know is right here HOWTOMAKEMONEY.COMUF.COM

  7. This video is a little dated now … things have changed on the screens so much you should consider taking this down and making an update.

  8. please guide me, i have installed plesk on centos, when ever i enter the url with port number it converts the url name to the instance name of the webserver like when i browse https://www.example.com:8443 it convert the url to https://VM-InstanceName:8443

Leave a Reply

Your email address will not be published. Required fields are marked *