[MUSIC PLAYING]
GUSTAVO FLORES: Hi, everyone.
My name is Gustavo Flores, and I'm a customer engineer here
at Google Cloud.
DANIEL FUENTES: And I am Daniel, also a customer
engineer at Google Cloud.
GUSTAVO FLORES: Welcome back to the Google Cloud Technical
Guides for Startups, where we're creating a series of videos
for technical enablement to help startups to start, build,
and grow their businesses successfully and sustainably
on Google Cloud.
In our previous episode, we shared with you
how you can get started with Compute on Google Kubernetes
Engine.
Today, we're moving on to Compute with Google Compute
Engine.
We're going to kick off by covering
what is Compute Engine?
Following that, I'll be going over some common Compute Engine
configuration you may want to modify.
Then we'll have a demo of Compute Engine
where we'll do the following--
show source code in Cloud Shell, create an instance template
for your instances, create a managed instance
group for your template, deploy an application
to the instances running on the Manage Instance group,
and put a load balancer in front of the group
so that we can access the application.
Then were going to review a customer success story.
So what is Google Compute Engine?
Compute Engine is an intuitive, and flexible, simple at scale,
and secured compute service that lets you create and run
your applications on Google Cloud's global infrastructure.
Let's talk flexibility.
There are six different VM families--
three within the general purpose,
and three that are optimized for specific types of workloads.
General purpose VMs are ideal for a wide variety
of applications like web serving, databases, and image
processing, and come in flavors optimized
for either cost or a balance of price and performance.
Workload optimized VMs include compute, memory,
and accelerator optimized options
for your most demanding applications,
such as SAP Hana and high performance computing.
You can achieve even greater savings
through taking advantage of Spot VMs.
Spot VMs are affordable compute instances
suitable for batch jobs and fault tolerant workloads.
Google Cloud Spot VMs guarantee higher minimum savings
and more predictability in pricing for spot instances
compared to other cloud providers.
Let's talk security.
Google Cloud and Compute Engine are
designed to be secure by default. For enhanced security,
you can leverage Shielded VMs.
Shielded VM features include verifiable integrity
with secure and measured boot.
Secure boot helps prevent malicious code
from being loaded early in the boot sequence.
Measured boot ensures the integrity of the bootloader
and kernel, and boot drivers to guard
against malicious modifications to the VM.
vTPM Exfiltration Resistance-- you can validate your guest VM
pre-boot and boot integrity using vTPM technology, which
is compatible with trusted computing group TPM 2.0
specifications.
Trusted UEFI firmware-- trusted firmware
is based on the Unified Extensible Firmware Interface,
or UEFI 2.3.1, which replaces legacy BIOS
subsystems and enables UEFI secure boot capability.
Tamper evident attestations-- gain insight
into the integrity state of Shielded VMs
with tamper evident attestation claims available in Cloud
Logging and Cloud Monitoring.
These integrity measurements help identify changes
from the healthy baseline of your VM and current runtime
state.
Live migration and patching--
keep your virtual machines instances
running even when a host system event occurs,
such as software or hardware updates.
You can define IM policies and permissions,
and you can set these policies and permissions
that constrain all new Compute Engine
instances to use Shielded VM disk images
and have vTPM and integrity monitoring options enabled.
You can shield existing VM images, too.
Transform your existing VMs into Shielded VMs
that run on Google Cloud, bringing verifiable integrity
and exfiltration resistance to your existing images.
With Google Compute Engine and Cloud TPU,
SenSen delivers highly scalable SaaS AI based solutions
across the globe.
SenSen's platform analyzes and fuses
data from different IoT devices to deliver insights
across multiple industries.
They said, "With Compute Engine and Cloud TPU,
SenSen can spin up VMs and configure TPU clusters
on demand with minimal effort.
An expanding capacity or extending functionality
is fast and easy."
DANIEL FUENTES: I'm going to demonstrate
how to create a Compute Engine managed
instance group to deploy a simple web application.
Docker will be used to build the container images
and deploy them in our virtual machines.
We're also going to expose our application to the internet
by using an external HTTP load balancer.
Our sample application is a simple guestbook,
where visitors can submit messages and clear them.
We can perform these steps by both using the Google Cloud
SDK in the Cloud Shell or using the Google Cloud console.
Before we get to deploy our app, I
will use Cloud Shell to clone the GitHub repo
and use the text editor to show you the code.
You can find the link to the GitHub
repo in the video description if you want to follow along.
Let's click the Activate Cloud Shell
button at the top of the Google Cloud console,
and we see the Cloud Shell session open inside a new frame
at the bottom of the console and display a command line prompt.
Let's use this terminal to enter the git clone command
and clone the repo.
Cloud Shell comes with a built-in code editor
that we'll use to read the code.
Launch the Cloud Shell editor by clicking the Code Editor button
on the toolbar of the Cloud Shell window.
Now, let's use the left hand pane to navigate to the code
by clicking on the CP100 folder, then App folder,
and select the app.py file.
As you can see in this Python script,
Flask is used for handling HTTP requests for publishing
and clearing messages, and [INAUDIBLE]
is used to save the entries.
We also have a Docker file containing all the commands
to create the images that will be used
to run our Docker container.
I am now going to show you how to create an instance template.
Instance templates are a convenient way
to save a virtual machine's instance configuration
so you can use it later to create a virtual machine
or a group of virtual machines.
Let's navigate to Compute Engine using the left-hand pane
and click Instance Templates.
Click Create Instance Template, and it is now
time to enter our desired configuration.
Let's give it a simple name--
Guestbook Server Template.
Under the Machine Configuration section,
we can see virtual machines are classified by machine family,
series, and machine types.
For our application, let's select
a general purpose E2 medium, which we can see
has two vCPUs and 4 gigs of memory.
Under the Boot Disk section, we can click the Change button
to select the operating system and its version
and the disk type and size we want for our virtual machines.
Let's add our startup script, which
will install Docker, build the image, deploy the container,
and expose it internally.
Our individual machines don't need an external IP
because we will expose the app to the internet using a load
balancer, so let's specify None as the external IP.
And finally, let's click Create.
Now that we have our template, let's
use it to create a managed instance group.
Managed instance groups lets you operate apps
on multiple identical VMs and make your workload scalable
and highly available.
You can take advantage of automated services,
including autoscaling, auto healing, multiple zone
deployment, and automatic updating.
From the instance template section,
expand the Action menu next to the Guestbook Server Template
and click the Create Instance Group button.
We now see the configuration options for our group of VMs.
Let's give this group a simple name like Guestbook Server MIG.
And we can now decide if we want our VMs
to be deployed in one or multiple zones.
We will keep this in the US Central 1a zone.
Notice we can configure the autoscaling mode and policy
and minimum and maximum number of VMs, autoscaling metrics,
auto healing, and other aspects of our managed instance group.
Let's go ahead and click Create.
Now, if we navigate to the VM instances menu,
we're able to see all the individual machines that
are part of our managed instance group.
Let's go ahead and check that Docker is running correctly
via SSH.
Click SSH under the Connect column,
corresponding to the only instance
in our group in the Instances list to SSH in the new window.
We'll use the command sudo systemctl status docker.
In the resulting output we can see
the container Engine is active and running
a container as intended.
Before creating our load balancer,
we need to create an ingress firewall
rule applicable to the group of VMs
being load balanced to allow health checks.
Let's use Cloud Shell to create this rule.
Notice the two source IP ranges and protocol
needed to allow health checks.
Now, let's create a configuration
by selecting the back end services input
box and click the Create a Back End Service button.
Let's give it the name Guestbook Back End,
and let's choose Guestbook Server MIG instance
group as your back end.
Enter 80 for the port number.
Our back end requires us to create a health check,
so traffic is only directed to healthy machines,
so let's select the Health Check Input box
and click the Create Health Check.
I will name this Basic HTTP Health Check and leave
the default values.
Let's select our newly created health check and click Create.
Now, let's review the front end default configuration.
And we can see the protocol will be HTTP.
An ephemeral IPv4 IP address will be assigned,
and port 80 will be used.
Everything looks good, so we can click on the Create button.
Let's review some of our load balancer details
by clicking on the Guestbook HTTP LB in the load balancers
list.
And we're now able to use this IP
address to use the web application running
in our managed instance group.
Let's use the browser to visit the application
by copying and pasting the IP address and port in the address
bar.
And here it is--
our simple guestbook application.
Now, let's leave a short message in our guestbook--
Hello, Google Cloud.
And we're set.
We deployed our guestbook application
to our managed instance group and exposed
it using a load balancer.
GUSTAVO FLORES: And if, after this session,
you cannot get enough of Compute Engine and are keen to find out
more, check out the suggestions here and the links
in the description box below.
You can read up on Compute Engine.
You can check out the Google Cloud Drawing
Board on Compute Engine, or you can try our Qwiklabs
on Compute Engine.
In our next episode, you'll be learning about Google Cloud's
global network.
It will cover VPC networking, firewall rules, load balancers,
a demo where we'll configure the network for the booking
application you saw earlier.
Finally, another customer success story.
Thank you, and we'll see you in the next video.
[MUSIC PLAYING]