This content is an introductory course module focused on Google Cloud Platform (GCP), specifically designed to prepare learners for the Google Cloud Certified Associate Cloud Engineer certification. It emphasizes hands-on learning and practical application of GCP services, starting with fundamental concepts like cloud computing and progressing to core services like Compute Engine.
Mind Map
คลิกเพื่อขยาย
คลิกเพื่อสำรวจ Mind Map แบบอินเตอร์แอคทีฟฉบับเต็ม
cloud is growing 50 percent
every year and the enterprise world is
going multi-cloud
more than ever before it is important to understand
understand
and learn multiple clouds i am ranga karnam
karnam
i am the founder of in 28 nits and
creator of some of the world's
most popular courses on cloud and devops
i have helped 600 000 learners across
the world
acquire new technology skills rest assured
assured
you are in good hands in this course
you will learn google cloud from xero
if you have some experience with the
cloud before aws for instance
that's cool you can build audit during
this course
if you do not have any experience with
the cloud that's awesome too
you can start your cloud journey with
one of the amazing cloud platforms
google cloud certification courses can
be boring
with tons of theory and zero practice
i'm a great believer that the best way
to learn is by doing
and that's why we designed this course
to be hands-on
you will play with a number of google
cloud services compute services storage
services databases
networking and a lot of other services
you'll be exposed to a number of modern
architecture trends during this course
serverless microservices containers
container orchestration with kubernetes
and by the end of the course you will be
all ready for your
google cloud associate cloud engineer certification
certification
are you ready to start your google cloud
journey and become a good cloud certified
certified
associate cloud engineer what are you
waiting for join me
on this exciting journey right now i'll
welcome back welcome to this course to
help you become a google certified
associate cloud engineer i am ranga karanam
karanam
and i am excited to be your instructor
for this course
in this step let's get a 10 000 feet
overview of the certification
and understand how you can make the best
use of this course
gcp or the google cloud platform has
200 plus services a little later in the
course we'll be
signing into google cloud platform web console
console
it is also called just the console and
you'd see
that there are a wide variety of
services under different categories
that are offered by the google cloud
platform a few years back
when i was first starting with the
google cloud platform they were half the
number of services that you are seeing
in here so this is an ever growing list
of services
and from these services this exam
expects you to know
40 plus services this exam expects you
to have in-depth knowledge about these services
services
not only that this exam also tests your
decision making abilities
which service do you want to use in a
specific situation
what is the right compute for a specific scenario
scenario
what is the right database to be using
in a specific scenario
and that's the reason why we designed
this course to help you make these tough
choices you will not only learn in depth
about these services
but also understand the various
scenarios where you want to use a
specific service
our goal is not only to help you get
certified but also equip you with
real world skills we want you to be able
to take the knowledge you have gained in
this course and apply it to your projects
projects
and how can you make the best use of
this course how can you put your best
foot forward
remember that this is a challenging
certification it expects you to understand
understand
and remember a number of services and
you are human
i am human and as humans we tend to
forget things over a period of time
if i'm learning something new today i
would forget most of it by the end of
the week so how do you improve your
chances of remembering things
for a long time here are a couple of recommendations
recommendations
from my experience number one active learning
learning
think and make notes whenever you see
something interesting
write it down number two review the presentation
presentation
once in a while every couple of days or
every week
take a step back review the presentation
and videos and think about what you have learnt
learnt
the more you are actively involved with
the learning and the more you review
the higher the chances that you remember
a lot of things and what is our approach
to building a great course
to help you remember things for a long
time we have taken a three-pronged approach
approach
number one is presentations we have a
number of videos
where we introduce these gcp services
and help you understand the different
concepts related to them
number two is demos we have a number of
videos where we play with these services
and try and implement the concepts that
we learnt and number three
is two kinds of quizzes we have text
quizzes the traditional ones where you
have a question
a set of choices and you pick the right
one in addition to them we also have
video quizzes during this video quizzes
we pick up a few scenarios
we try and understand the solution for
that and also discuss the alternatives
in depth
by using this three pronged approach we
think you'll be able to remember these
things for a long time
and you will be able to do really really
well at your job as well as your
certification exam now before we move
into the next step
a couple of recommendations for you
number one take your time
this is not a race so do not hesitate to
replay the videos
and try and understand the concepts in
depth number two
have fun certification courses can get boring
boring
and that's the reason why we invested a
lot of time to try and make this course
really interactive really hands-on and
making sure that you'll have a lot of fun
fun
while you learn i'm really excited to
help you get gcp certified and i'll see
welcome back in this step let's
understand what is cloud
and why do we need the cloud let's
consider a couple of example use cases
let's start with a online shopping application
application
what is the challenge that an online
shopping application faces
online shopping applications typically
have peak usage during holidays
and weekends for example during the
christmas period and the new year period
you'd have a lot of load on the application
application
and rest of the time you will have low
loads on the application
now what was the solution before the
cloud the solution before the cloud was
to do peak load provisioning what is
peak load provisioning
it is to buy infrastructure or procure infrastructure
infrastructure
for the peak load so if this is the peak
load you expect you'd buy infrastructure
to support that kind of a load now think
about this
what would that infrastructure be doing
in periods of
low load it would just be sitting idle
now let's consider another example take
a startup
what is the challenge that it faces this
challenge is also kind of a good news
the startup suddenly becomes popular but
what do you need
is more infrastructure to support the
load how do you handle the sudden
increase in the load
what was the solution before the cloud
again it was to procure infrastructure
assuming that you'd be successful and
what if you are not really successful
all the infrastructure that you bought
is wasted so the typical challenges
before the emergence of cloud
were the high cost of procuring
infrastructure if you want to buy
infrastructure ahead of time
it is very expensive and it also needs
ahead of time planning can you really
guess the future
can you accurately estimate the peak
load the other challenge
is low infrastructure utilization you
can do peak load provisioning and buy
infrastructure for the peak load
but during the rest of the time the
infrastructure is wasted you have low
infrastructure utilization
and you need a dedicated infrastructure
maintenance team
to maintain this infrastructure think
about a startup
can they effort a dedicated
infrastructure maintenance team
and because of these challenges we
started moving towards
the cloud whenever we use the cloud we
are talking about
a simple question how about provisioning
or renting resources when we want them
and releasing them back to the cloud
when you do not need them this is also
called on-demand
resource provisioning if you have high
load on your application if you have
huge number of users using the application
application
you'll provision or you'll rent a lot of
resources from the cloud
and once the load goes down once the
number of users on your application goes down
down
you'll release the resources back to the
cloud you can see that the number of
resources you use
increases with the number of users who
are using the application and that's why
this is also called
elasticity now what are the advantages
of this approach
you're trading capital expense for
variable expense
instead of investing money ahead of time
you are paying rent
you can benefit from the massive
economies of scale
each of the popular cloud providers have
millions of servers
and therefore they can get the best
deals from the hardware providers
and because the cloud space is very
competitive the cloud providers
pass on that advantage to their
customers that's us
the other advantage is that you don't
really need to guess capacity
anymore if the number of users increase
you can provision more servers
if the number of users goes down you can
release them back to the cloud
so you don't really need to guess
capacity anymore and
you don't really need to spend any money
running and maintaining your data centers
centers
the other big advantage is that you can
go global in
minutes imagine a startup in india
they can easily deploy an application to
multiple regions around the world with a
click of a button
and that's what cloud enables we have
now looked at some of the important
advantages of the cloud
where does google cloud platform fit in
gcp is one of the top three cloud
service providers
the other two are aws
amazon web services and azure microsoft azure
azure
gcp provides 200 plus services and over
the last few years gcp has proved to be reliable
reliable
secure and highly performant it is
important to remember that this is the
same infrastructure that powers eight services
services
with over 1 billion users some of the most
most
popular google services like gmail
google search
and youtube make use of the same infrastructure
infrastructure
that gcp provides to us and one thing i
really love about google cloud platform
is that it is the cleanest cloud as of
today it is a net carbon neutral cloud
the electricity which is used to run the
cloud is matched hundred percent
with renewable energy we will learn a
lot more about the google cloud platform
or the gcp
as we go further with the course now we
go to the cloud
because of on demand resource
provisioning and gcp is one of the top
three cloud service providers
and our goal with this course is to help
you learn gcp
is there a best path to learn gcp
whenever we talk about cloud
applications they make use of a number of
of
cloud services there is no single path
to learn these services independently however
however
what we have done is we have done a lot
of research and worked out a very very
simple path
of introducing all these services to you
step by step
and that's what we would be doing
starting the next step
in the next step let's get started with
setting up our google cloud platform
account i'm really excited to help you
learn google cloud
welcome back are you excited to get
started with playing with the google
cloud platform
the exciting thing is google cloud
provides you with a free trial account
it provides you with dollar 300 free
credit so that you can play with the
google cloud platform
what i recommend you to do is to login
into your google account and then go to cloud.google.com
cloud.google.com
and once you are here you can go and
click get started for free on the next page
page
you can choose your country you can read
and if you are okay agree to the terms
of services
as you can see in here google cloud
platform provides you with dollar 300 credit
credit
for free and an amazing thing is that
there would be no auto charge
after the free trial ends that's cool
now you can go ahead and click continue
on the screen and in the next screen
you need to enter a lot of information
about yourself typically you choose the
account type as individual
and you can also provide the tax
information if you are interested too
you'll also be asked for your address
details and you can choose how you'd
want to pay for the services
on next screen you can enter your
payment method you need to enter your
card details depending on the country
you are
in google cloud has different
verification approaches
so google cloud would verify your card
and in some countries they might even do
a small transaction to your credit card
once you have verified your card you can
go ahead and click
start my free trial if everything goes
fine then you should see
a screen like this you are now all set
to continue playing with the google
cloud platform one of the important
things i'll remind you
is to ensure that you make the best use
of the free trial
make sure that you learn as much as
possible using the free trial account
i'm really excited to get you started
with google cloud platform and i'll see
in this tip let's understand why we need regions
regions
and zones what are regions and zones and
why do we need them
let's consider a simple scenario imagine
that your application is deployed in a
data center
in the london region what would be the
challenges with such an
architecture the first challenge is slow
access to users from the other parts of
the world
if you have users in mumbai or new york
or sydney
they would get slow access this is also
called high latency
number two what if the data center crashes
crashes
your application goes down so you have low
low
availability now how can we improve this further
further
what we do is we would add in another
data center
in london so you got a new data center
and you deployed the application in
there so now we have two data centers
now what would be the challenges with
this kind of an architecture challenge
one remains
users from other parts of the world will
still have slow access
however challenge 2 is solved even if
one of the data center crashes what
would happen
my application would be served from the
other data center so your application is
still available from the other data center
center
now let's add in a new challenge what if
the entire region of
london is unavailable what would happen
your application
goes down now how do we improve this
what we do
is we would have the same architecture
set up in two regions so we are adding
in a new region called
mumbai what are the challenges enough
challenge one slow access to users from
other parts of the world is
partly solved access from mumbai would
be fast
but access from other regions of the
world for example new york or sydney
will still remain
slow and you can solve this by adding
deployments for your applications
in other regions challenge 2 was already solved
solved
even if one of the data center crashes
we can serve it from the other data center
center
now the challenge three what if the
entire region of london is unavailable
what would happen now if
your application will be served from mumbai
mumbai
now we understood the reason why we need regions
regions
and zones we would want to deploy our
application across multiple regions
because we want high availability
and low latency for our users now think
about this
you want to set up data centers in
multiple regions
around the world is that easy
the answer obviously is no and that's
where the cloud providers help us
let's see how gcp helps us to solve this
welcome back in the previous step we
talked about the fact that
setting up data centers in different
regions around the world
is not easy and that's where all the
cloud providers
including google provide us with regions
around the world
google provides 20 plus regions around
the world which is an ever
expanding list there are new regions
added in
every year a region is nothing but a
specific geographical location
to host your resources so you can decide
that i would want to host
my applications in mumbai region or i
can say
i would want to host my applications in
london region
or sydney region by having multiple
regions around the world
google cloud makes it very very easy for
you to deploy applications to these regions
regions
the important advantages of having
multiple regions around the world is
high availability
if you deploy your application to
multiple regions around the world even
if one of these regions is down
you can serve the application from the
other regions
low latency you can serve users from the nearest
nearest
region to them and therefore they get
low latency
global footprint a startup in india
might be able to easily deploy application
application
to multiple parts of the world and
therefore it can create
global applications the last advantage
is adherence to government recreations
different countries will have different
regulations for example
let's say u.s wants the data related to
all their citizens
to reside within u.s only in those kind
of situations i can create
a region in u.s and store data related
to u.s customers
only in that specific region so regions
help us achieve high availability
low latency global footprint and help us
to adhere
to government regulations what is the
need for zones
how do you achieve high availability in
the same region so i would want to
deploy my application
just in mumbai region maybe there is a
garden regulation because of which i
would want my application
only in mumbai region but even with that
restriction i would want high availability
availability
how can i get that that's where within
each region
there are multiple zones in google cloud
each region has at least three zones
the advantage of having multiple zones
is increased availability and fault
tolerance within
the same region i can deploy my
application to each of these zones
so that even if one of these zones
crashes my application can be served
from the other zone
in google's language each of these zones
has one or more
discrete clusters in simple language
each of these zones have at least one or more
more
data centers an important thing to
remember is that these zones are
connected with
low latency links so even if you deploy
an application to zone 1 and the
database to zone 2
you'd get really good performance so
google cloud platform provides multiple
regions around the world and each of
these regions have
at least three zones let's see a few
examples for that right now
example region is u.s west one
this is in the continent of north
america in a place called
dals or dallas however it's pronounced
and inside this there are three zones
and the zones are named u.s west one a
west one b
and west one c let's consider another example
example
europe north one is the region this is
in hamina
finland and you can see that even that
region has three zones
north one a north one b and north one c
another example is asia south one which
is nearer to me which is mumbai india
and you can see that it also has three
availability zones
asia south 1a asia south 1b and asia
south 1c
in this step we got introduced to the
concept of regions and zones
in google cloud platform i'll see you in
welcome back in this step let's get
started with
a very very important google cloud
service called the compute
engine whenever you want to deploy applications
applications
you'd need servers and when you want to deploy
deploy
applications in the cloud you need
virtual servers
and that's what compute engine enables
you to provision
in google cloud let's get started with
compute engine in this specific step
incorporate data centers applications
are deployed to physical servers
where do you deploy applications in the
cloud in the cloud
we would rent virtual servers and
virtual machines
are the virtual servers in gcp
and how do you provision virtual
machines the service you would make use of
of
is google compute engine so google
compute engine
is the service in google cloud platform
to provision
and manage your virtual machines now
what are the features that it offers
it helps you to create and manage the
life cycle of
virtual machine instances you can create
a virtual instance machine you can
actually start
stop restart or terminate a virtual
machine instance
you can also implement load balancing
and auto scaling for multiple vm
instances if your application is
deployed to multiple vm instances
you'd want to have a load balancer to
distribute the load between them and also
also
you'd want to be able to do auto scaling
you'd want to be able to increase the
number of instances
based on the load if you have a lot of
users using the application
then you want to increase the number of
instances otherwise you want to decrease
the number of instances
compute engine also allows you to attach
storage to your
virtual machine instances you'd want to
run your operating system on a hard disk
and connect it to your virtual machine
compute engine also allows you to manage
the network connectivity
and configuration for your vm instances
you want to assign a
ip address for your vm instance and
you'd want to be able to use the ip address
address
to talk to your virtual machine or to
send a request to your virtual machine
so google compute engine enables you to
manage the life cycle of your virtual
machine instances
it provides a number of additional
features like attaching storage load balancing
balancing
auto scaling and managing the network
connectivity to your vm instances
now i'm sure you are getting bored with
all the theory that we are talking about
what we will do in the next few steps is to
to
set up a set of vm instances as a web
server or http server
and you want to distribute load between
them using
load balancers in this quick step we
were introduced to what
is a compute engine google compute
engine is a service which enables you to create
create
virtual machines in gcp and it
provides you with a number of features
let's start playing with google compute engine
engine
welcome back let's start playing with
google compute engine in this specific step
step
what we'll do is we'll create a few vm
instances and play with them
in addition to that you check out the
life cycle of these instances
basically you try and start stop restart
and try a variety of operations that you
can perform with them
and also you would use ssh to connect to
the virtual machine instances we would
ssh into the virtual machine instances
and try and run a few commands
let's start with creating a few virtual
machine instances
and to be able to do that let's go to
google cloud web console
you can go over and type in the url cloud.google.com
cloud.google.com
and over here you can click console
which is present in here
so this is the web console or it's just
called the console
this is kind of the web interface where
you can play with all the resources that
you provision
as part of your google cloud platform if
you're coming here for the first time
and if you are still in the free trial
then you should see a message like this
what i recommend you to do is to click dismiss
dismiss
and now you should not see that message
anymore when you log into google cloud
console you should see the dashboard page
page
where you'd be able to see the project
information you'll be able to see the
different resources that are part of
this particular project
and the different apis and the requests
related to them
let's not worry about all this stuff
what we are really interested in for enough
enough
is creating a compute engine so i can
type in
compute engine in here
so over here you can go to compute engine
engine
if this is the first time you are using
compute engine then this page would take
a little while to load
it might take about five minutes before
you'll be able to see the create button
in here so we are making use of the
compute engine
service and we want to create a vm instance
instance
let's go ahead and say create there are
a lot of details that you need to
provide to create a vm instance
on the next screen we can fill the
details the first one is the name
so i'll give a name as my first vm
whenever we create resources in google
cloud platform we can associate
labels with them labels would be let's say
say
the environment for example so let's say
this is the
dev environment for me so i'll say i'll
add a label called environment
dev um you can also add labels for
business unit
so let's say the business unit which it
is related to is sales
so you can add different labels
indicating more information about the vm
i'll go ahead and say save in here so we have
have
added in a couple of labels environment
dev and business is sales
next we have to choose the region and
the zone
i recommend you to take the defaults the
default which is suggested for me is us
central one region and your central one
a as the zone after choosing the zone
and the region what you need to choose
is the hardware you would want to run
your virtual machine on
that is called the machine configuration
google cloud platform provides you with
a number of machine
families which are optimized for
different kinds of applications
you'd see general purpose which are
machine types for common workloads
optimized for cost and flexibility if
you go to compute optimized you would see
see
high performance machine types for
compute intensive applications
there are also memory optimized so these are
are
large memory machine types for memory
intensive workloads
so based on the application that you are
going to run you can choose the specific
machine family that you would want to use
use
for now let's choose general purpose and
stick with the default which are
suggested and if you go further down
there is one more important choice what
operating system you would want on your
virtual machine
the way we choose that is by choosing
the image
if you click change you'll be able to
see all the different
images that are made available by google cloud
cloud
so you'd see that there are images
related to different
operating systems that are provided
so you can see debian red hat linux you
can see ubuntu
windows server and a lot of other
options for now let's choose the default
which is debian
let's stay with that and let's say cancel
cancel
if you scroll a little down you'll also
see something called a firewall configuration
configuration
as we discussed earlier we'd want to run
a http server
on the virtual machine and we would want
to allow
http traffic so that somebody from
outside can
access the application which is running
on your virtual machine
and that's the reason why you would want
to allow http traffic
so in the firewall you can click allow http
http
traffic so basically what we have done
until now is we
gave the virtual machine a name we
attached a few labels with it
and we chose the default hardware which
is nothing but a machine family
and we chose the default software which
is nothing but
the image which is used to create your
vm other than that we enabled the
firewall to allow
http traffic now if you scroll a little
bit to the right you can see the cost
involved as well you can see that
running this for a month would cost
me around 24 dollars that's about 0.034 dollars
dollars
per hour and this would be taken from my
free credit one of the important things
i would recommend you to do
is to play with it and immediately stop
the instance that you create your free
credit is very very valuable
and don't waste it on keeping the
instances running so let's go ahead and
create it for enough
and immediately as soon as our demo is
done let's go ahead and stop
or terminate the instance so let's go
ahead and create the instance right now
so i've started creating the instance
the creation of the instance would take
a little while
i'll see you in the next step with more
about virtual machines
welcome back in the last step we started
creating our virtual machine
and while the creation of the virtual
machine is in progress let's discuss a few
few
important things about the virtual
machines that we created
there are a couple of important choices
that we made when we created our virtual machines
machines
using the google compute engine number
one is what is the hardware
number two what is the operating system
and the software that you would want
on your specific virtual machine let's
start with the first decision that we
made what is the hardware that we would
want our virtual machine to run on
when we talk about the hardware of a
virtual machine there are two
important things that you need to
understand one is the machine family
and two is machine type different
machine families are present for
different types of workloads
the general purpose is the one which is
recommended for most workloads this
provides the best
price performance ratio so if you want
to run a web application or a simple
application server or if you want to
create a small
or medium sized database or if you want
to run your dev environment
in those kind of situations you can go
for general purpose family
if you have ultra high memory workloads
you want a lot of
ram to run your applications in those
kind of situations you can go for memory optimized
optimized
families examples are when you want a
large in-memory database or if you want
to perform analytics
in memory the other kind of use cases
are compute
intensive workloads and for these kind
of use cases you'd go for
compute optimized families
for example if you have a gaming
application that you'd want to run
you need a lot of cpu and in those kind
of situations you would go for compute
optimized families
so the first choice you are making is
based on the type of application you
want to run you are deciding the machine family
family
once you choose the machine family you
need to choose the machine type
how much exact amount of cpu memory or disk
disk
do you want for each of the machine families
families
there are a number of machine types
earlier we saw e2
was a machine family and for e2
there are a number of machine types e2
standard 2
e2 standard 4 e2 standard 8 16
and 32 let's take one of them e2
standard 2.
e2 here represents the family machine
type family standard indicates the type
of workload that you would want to run
and 2 here indicates the number of cpus
you can see that e2 standard 2 has two vcpus
vcpus
e2 standard 4 has 4 virtual cpus e2
standard eight
has eight and so on and so forth
the other thing you can observe in here
is that the memory disk and networking capabilities
capabilities
increase along with the virtual cpus so
if you go for a larger machine type
you have higher amount of memory
available for you and also the disk and
the networking performance also will be better
better
over here you can see that the memory
increases as the number of vcpus
increase so that's the first choice what
is the hardware you want to run your
virtual machine
on we would first choose the machine
type family
and then we would choose the specific
machine type and the second question is
what is the operating system and what is
the software we would want on a virtual machine
machine
instance that's what we decide by
choosing the image
there are two types of images that are
present in google cloud one is the
public image
earlier we chose debian as the image to
create our virtual machine
that's an example of a public image
these public images are
maintained by google or open source
communities or by
third party vendors the other kind of
images are custom
images these are images created by you
which are customized by you for your
specific projects
the important takeaways until now are
you choose your hardware by deciding
your machine type
you choose your software by deciding
your image
now let's go back to our virtual machine
and see if it's ready when i go to the
vm instances
i can see that my virtual machine is up
and running
that's cool you can also see that it's
created in a specific zone
us central 1a and you can see that there
is an
internal ip and an external ip which is assigned
assigned
the external ip is the one which we can
make use of to talk to this virtual machine
machine
from the internet you can also ssh into
the virtual machine
by using this button which is present in here
here
other than that if you click this
specific thing you can see the different
operations that you can perform
on the virtual machine instance you can
see that you can stop the virtual
machine instance
or you can suspend it suspended suspend
is basically like a
pause so you can pause it and resume it
or you can reset
reset is nothing but a restart so the
instance would be stopped and restarted immediately
immediately
you can also delete the instance
for now what i would want to do is to
ssh into it and run a few commands
what i'll do is i'll click ssh when i
click ssh i can see
a notification that pop-up windows are blocked
blocked
ssh would actually open as a pop-up
window and that's the reason why i would
need to enable pop-ups
and once i enable pop-ups i'd be able to
ssh into the vm instance let's say
connect if you're having any problems
with launching up the virtual machine i
would recommend you to also try with
google chrome
now i'm able to ssh into the virtual machine
machine
and over here i can run a few commands
but the font size
is very very small so what i can do is
actually go in here
and actually change over so i'll change
the current color
theme to light and i would actually
change the text size to largest
cool you'll be able to see this much
more clearly i guess
and now i can go in here and type in a
command who
am i you can see my username is printed
in here let's print the current working directory
directory
pwd it's print it showing the
current working direct let's list all
the files which are present in here
ls you can see that there are no files
present in this specific directory
in this step we launched up our virtual machine
machine
and we were able to ssh into it
let's play with it furthermore in the
subsequent step
welcome back in last step we launched up
our virtual machine
and we were able to execute a few
commands on it
instead let's see how to set up a http
server on our
compute engine virtual machine i want to install
install
some software on this specific machine
so before i
do anything i need to actually become a
root user
so i would say sudo space su this is the
command to actually become
a root user and once i do that
what i would want to do is to update all
the packages which are present
in here apt is a package manager which is
is
installed by default on debian and i can
do apt
update i can do a app update to pull in
all the latest changes
now once i updated the package index
what i would want to do is to install
apache apache is the http server that we
would want to run on the virtual machine
the way we can do that is by saying apt install
install
apache 2
so apache 2 is the name of the package
so we want to install apache 2 package
using the package manager apt
let's press enter so you can see
that it's providing us with a little bit
of information about the apache package
it is showing what would be installed
how much memory it would need
and it's asking us do you want to
continue and i would say
yes you can see that it's downloading
the package
and it's installing it in here so apache 2
2
it took about a minute to install apache
service and at the end of it
the apache service is now installed
now i can go back to the virtual machine instance
instance
one of the interesting things to know is
if you see a panel come up like this you
can click the hide
info panel so show and hide
so when you select a specific virtual
machine you can click show info panel it
would show information about that specific
specific
virtual machine and if you want to hide
the info panel you can actually
hide it as well that might be useful as
you play with the
console a lot more we have launched up
apache server
and we want to look at the page behind that
that
the way we can do that is by clicking
the external ip so you can go in here
and click the link to the external ip
and you should see the home page of
apache 2 debian
come up over here you will see a lot of
information about configuration of
apache and you would see
that the default debian document root is
this specific folder
now we want to customize this page so
instead of this page we would want our
own page to come in here
how can we do that that's where we would
want to customize some things present in
this specific
directory so i'll copy this directory
path from here so slash wire slash www
slash html so i'll say ls
slash var slash www.html
make sure that you don't have a dot or
anything in there and you can press enter
enter
and you can see that there is an
index.html file which is present
in here and that's the index.html where
we want to put our content
in echo and let's say
hello world
and i would oops
and i would put a double quote to end
this so echo hello world
so this would print hello world in here
now what i would want to do is to
actually send this out
to a file so i can use a pipe character
so it's nothing but the greater than symbol
symbol
so you can pipe the output into this
file so slash var www.h
html index.html
so this is where we would want to write
hello world into
now let's go in here and refresh the page
page
cool now i see hello world in here
so that's cool so we are able to create
a simple
apache server serving a simple hello
world page
now let's try and make this a little bit
more complex
let's say i would want to actually have
my host name in here
instead of just saying hello world i
would want to actually add in a host
name to say
to say this is the host name where this
response is coming from
how can i do that let's start with echo
let's try and print that out
so echo the way we can print the
hostname is by saying dollar
host name within parenthesis
so dollop within parenthesis host name
so this would actually print
the host name the host name that we gave
earlier to this
particular virtual machine is my first
vm and similar to that you can actually
do a echo host name
hyphen i this would give you the ip address
address
so what i would want to do is i would
want to add this information to my index.html
index.html
so let's start with actually printing echo
echo
hello world from
dollar within parenthesis
host name and let's press enter let's
see what would happen
yeah this is printing hello world from
my first vm that looks cool
i'll say hello from from this specific
hostname and i'll also want to print the
ip address so i'll say
dollar within parenthesis output hostname
hostname
hyphen i and press enter
this is printing hello world from my
first vm and the ip address
if you go in over here you would see
that this is the internal ip address
so 10.128.0.2 is the internal ip address
that is what is being printed in here
so that looks cool so what i would want
to do is to actually take this message
and send it to the index.html so
i'll just take the same thing echo hello
world from this specific thing
and i would want to pipe this where do
you want to pipe this to this particular file
file
so let's paste that in and
let's see if we are able to see it in here
here
cool you can see hello world from my
first vm
10.128.0.2 in this step we installed apache
apache
on our virtual machine you saw that it
was very very easy
all that we needed to do was to ssh into
it install the software that we needed
and we could easily customize the page
that we want to render from our apache
web server
there are a lot of other things that we
would want to learn about virtual
machines and this example would be a
great starting point to learn all of them
them
i'm sure you're having a lot of fun and
i'll see in the next step
welcome back in the last step we saw a
couple of ip addresses
assigned to a virtual machine we saw
internal ip and external ip which is
assigned to this virtual machine
let's understand a little bit more about
internal ip and external ip in this
specific step
external ip addresses are internet addressable
addressable
we were able to call this specific
external ip from outside
right i'm on the internet and i'm
reaching out
to a specific virtual machine which is
installed inside the
google cloud platform so this is
internet addressable
internal ip addresses are internal to a
corporate network
in this specific example the virtual
machine is installed inside the gcp network
network
and the internal ip address can only be
used inside
the google cloud network so you will not
be able to use this 10.
128.0.2 and send a request to it
that is not allowed whenever we talk
about external ip addresses
you cannot have two resources with the same
same
ip address the external ip is published
over the internet
and therefore you cannot have two
resources with the same public ip
however two different corporate networks
can have resources with the same
internal ip address because the internal
ip addresses are not available on the
internet they are just
internal to some network similar
internal ip addresses can be used
in two different networks whenever you
create a vm
instance by default it is assigned at least
least
one internal ip address whenever you are
creating a vm instance you can choose
if you want to create a external ip
address for it
an important thing to remember is the
fact that whenever you stop a vm instance
instance
the external ip address is lost
let's now see the internal and external
eyepiece in
play let's go over to our virtual
machine that we created earlier
and what i would do is actually try and
stop this so let's go ahead and say
stop and
and i'll say stop on the pop-up which
comes up as well before we stopped
this virtual machine had an internal ip
and an external ip
let's see what would happen when it
stopped you can also note down the
external ip right now it's 34
123 6.112. you might have a different
external ip but make sure that you note
it down
let's wait for the vm to be stopped
let's try and refresh this
cool it took a little while about a
minute or so
and after that my virtual machine is
stopped and when the virtual machine is
stopped you can see that it is still
assigned a internal ip
however there is no external ip which is
assigned to it
now what i would do is i would go in
here and say start
or resume and i'll say start over here
as well
let's see what would happen cool i can
see that the starting of the virtual
machine is successful
and it is assigned a different external ip
ip
earlier this was the external ip i made
use of 34
123 6 and 12 and if i actually refresh
that right now
you would see that i would get a page
not found or i would get some error
because the external ip is now changed
you can see that my ssh connection
is also not working it says
connection wire cloud identity aware
proxy failed
so i can actually go ahead and say close
for the ssh
one as well because the external ips change
change
the earlier external ip is no longer useful
useful
now what i would do is i would actually
ssh again
so you can see that the ssh is opening
up as a pop-up window right now
and over here i want to execute the
command to start
the apache server earlier we stopped and
restarted the instance
before doing that let's do a pseudo su
to become the root
and after that i can execute a command
service apache 2 that's the service that
we installed earlier
and we can say start so we want to start
apache 2
service and once this service is up and running
running
i can go in and use the external ip
and you can see that it's saying hello
10.128.0.2
in this step we understood the concepts
of internal and external ip addresses
external ip addresses are addressable
over the internet
however internal ip addresses are
internal only to a specific corporate
network you cannot use them
from internet we also saw that when we
stop and start a vm instance
the internal ip address remains the same
however the external ip address
is changed when we restart a vm instance
the fact that an external ip address
changes when i restart a virtual machine
can be problematic how do we fix that
let's see that in the next step
in the last step we talked about
external ip addresses and we saw the
fact that an external ip address changes
when i stop and start a virtual machine
how do i get a constant external ip
address for a vm instance
one of the easiest ways to do that is to
assign a static ip address to the vm
a little later we'll look at a better
solution using load balances
but for now let's actually use a static
ip address
let's see how to use a static ip address
right now i'll
go to our google or platform and over here
here
you can type in external ip
addresses so we are
going into external ip addresses which
is part of something called a vpc
virtual private cloud and this is where
you can see
the external ip addresses which are
assigned to our virtual machines
so over here you can see that there is
an external ip address which is already
created for
our specific virtual machine so whenever
you create
a virtual machine with an external ip
address you can come over here and you
can see the
details of the external ip address which
is created however what we want
is not just an external ip address but
what we want is a static
external ip address and how can we
reserve that the way we can reserve that
is by
asking for reserve static address so go
ahead and say
reserve static address so i've clicked that
that
and over here now i can go and say
static ip
address when you're creating a static ip
address you can choose the network
service tier
so what kind of network performance do
you want there are two
levels which are offered one is premium
and standard
the default is premium i would go with
it you can also choose what kind of ip
address format you would want to use
i want to use either an ip address 4
format or a 6 format
i would go with ip address 4 and you can
also choose whether you want to create
a regional static address or a global
static address over here we would want
to assign the static address to
a virtual machine a virtual machine is
a resource which is created in a
specific zone so a regional static
address would be sufficient for us
now this would actually create a static address
address
and you can see the type in here so
by default whatever external ip address
is directly assigned to a vm
is ephemeral fmrl means it changes
so when you restart the instance it
changes however the address that we
created just now is static
you can see the static address in here
34 1 2 3 6
1 1 2. now we want to assign this to our
virtual machine how can we do that if
you actually zoom
out a little i mean the change button is
well hidden by google cloud
so you'd see a button called change in here
here
so on the static ip address if you zoom
out a little you should see a button
called change in here and that's the one
which you need to click
to change the ip address and i'll go
back to the normal zoom
and over here i can actually attach it
with a vm
i would say my first vm and i would say
okay so you'd see
that that static ip address is now
assigned to
the vm instance and when you refresh
you'd see that the fmrl address is
automatically released
so when i assign a static ip address to
a vm instance
the earlier ip address which was
assigned to it is automatically removed
so if i actually
refresh this this is the earlier ip
address which was assigned this was the
external ip address which was
fmrl and you can see that this does not
work anymore
and now i can actually use this static
ip address so i can take the static ip address
address
and i can use that and the amazing thing
about this static ip address is if i go
back to instances for example let's go
back type in vm instances
and let's go back to our compute engine
vm instances
and over here let's say i go in here and
stop
the stop would take a little while let's
wait for it to complete
let's try refresh nope this stop is
still going on
okay it took about a minute now this
stop is complete so even though we
stopped the vm instance
the static ip address is still assigned
to your vm instance in the step we
looked at how to get a constant external
ip address for
a vm instance the solution was to use a static
static
ip address we saw how to create a static
ip address and how we can assign it to a
vm instance
let's talk a little bit more about
welcome back in this step let's look at
a few things that you need to remember
about static ip addresses
an important thing that you need to
remember about static addresses is that
you can actually switch it
from one vm instance to another vm
instance in the same project
so if you actually create a new vm
instance in here
you can easily switch the static ip
address from
the current one to the new one the next
important thing to remember is that
static ip remains attached even if we
stop the instance
as you can see in here we have stopped
this specific instance still
the static ip is assigned the most
important thing that you need to
remember about static ip addresses
is the fact that you are built for a
static ip
when you are not using it typically for
most of the resources in the cloud
you are built for them when you are
making use of them however for static
ips you are built for them
when you are not using them now what i
would do is i will go in
and delete this specific instance so
i'll go ahead and say delete the
vm instance when i refresh the vm
instances i don't really have a vm instance
instance
now if i actually type in external
ip addresses and go
in to a vpc network
you can see that the static address is still
still
available so this static ip address
right now is
not used by anybody and this is the kind
of scenario when
you would be billed for it and that's
the reason why the best practice when it
comes to
static ip addresses is to go ahead and
release them so
i'll select this and go ahead and say release
release
static ip address so whenever you are
not using a static ip address the best
practice is to go ahead and release it
because you'd be built for it if you're
not using a static ip address
so make sure that you actually
explicitly release a static ip when
you're not using it
in this step we learned a little bit
more about the static ip address
welcome back in the last few steps we
created a virtual machine we instead
apache http server on it
however there are a lot of steps in
creating a vm and setting up the apache
http server on it
how do you reduce the number of steps in
creating a vm instance
and setting up a http server in the next
few steps we'll explore a few
options to do that the first one is
startup script we want to run a script
on the startup of a vm machine to
automatically install the apache server
the next option is an instance template
the last option we would explore is a
custom image
in this step let's get started with the
first option which is a startup
script how can we use a startup script
to setup a apache http server
on the start of a vm instance the
process of
installing any software or installing os patches
patches
when a vm instance is launched is called bootstrapping
bootstrapping
you know you are launching up a virtual
machine you want to be sure that it is secure
secure
how can you be sure that it's secure you
want to ensure that all the os patches
the latest ones are also
applied and one of the options to be
able to do that is to use a startup script
script
in the virtual machine you can configure
a startup script to bootstrap
let's now see a simple demo using the
startup script
so let's go back to our vm instances
game instances compute engine is where
and we don't really have any virtual
machine instances right now that's cool
let's go ahead and say create and over here
here
i'll call this my vm
with startup script
and i'll choose the defaults for most of
the things
i want i love http traffic so firewall i
love http traffic
and i would want to install some
software on launch of the vm machine
and for that we need to configure
startup script and to be able to do that
we'll click this management security
disk networking sole tenancy
it would open up a few tabs we will talk
about these tabs a little later
for enough we want to focus on the
startup script so if you scroll
little down in management you would see
startup script
you can choose to specify a startup
script that will run when your instance
boots up
or restarts startup scripts can be used
to install software and updates and to
ensure that the services are running
within the virtual machine
and as part of our startup script what
do you want to do we want to do an apt update
update
and then we want to install apache 2 and
then we want to set up
a simple page the exact script to use is
also present in the previous step so if
you want you can actually copy it from
there or from the ppt
so i'll go to the startup script and
paste this in
so over here in the startup script we
want to use bash
and we are saying app update and we are
saying app hyphen y install apache 2.
when we install apache 2 without using
hyphen y it would ask a question
we want to go ahead and install apache 2
and we don't want a question to be asked
that's why we add in an option hyphen y
and the echo is the same as what we had
earlier so now let's go ahead and say
create the two things that we have
customized is number one we enable http
access in the firewall
number two we configured a startup script
script
the instance is launched up what i
recommend you to do is to actually give
it a couple of minutes
so even after the instance is ready it
would take a couple of minutes
for all the software installs to happen
because we are installing a few things
on the launch
of the virtual machine so give it a
couple of minutes and then actually
click the external ip
and then you'd see something of this
kind hello world from my vp with startup script
script
10.128.0.3 and this is the internal ip
that matches in here in this step
we looked at how to automate
installation of os patches or any
software that you would want to install
when you launch a vm instance we did
that using
startup script as far as the exam is concerned
concerned
remembering about startup script is very
welcome back in the last step we played
around with startup script
and we simplified the installation of a
http server on a virtual machine
however let's say i would want to create
another instance what i would need to do
i need to go in choose the hardware
choose the software and then configure
the startup script then enable
http firewall and then go ahead and
create the instance
how can i avoid that how can i create my instances
instances
even more easily the question to ask is
why do we need to specify
all the vm instance details for example
image instance type
startup script and everything else
whenever you launch an instance
how about creating an instance template
when you create an instance template you
can define the machine type
the image labels startup script and a
lot of other properties
related to your virtual machine and you
can use that template to launch your
virtual machines
thereafter so this is used to create
virtual machine instances
and a little later we'll also look at
something called instance groups you can
launch a group of virtual machines you
can use instance templates to
launch individual vm instances or a
group of em instances
one important thing about an instance
template is that it cannot be updated
once you create an instance template you
cannot change it
what you can do is actually make a copy
of the existing template
and change it and create a new version
of it
another feature that is present with
instance templates is instead of
specifying a specific image
you can also specify image family when
you specify an image family the latest non-deprecated version
family the latest non-deprecated version of that specific family is used let's
of that specific family is used let's now try and create a
now try and create a instance template and create a couple of
instance template and create a couple of vm instances
vm instances how can i create an instance template i
how can i create an instance template i think that's very easy right i can go to
think that's very easy right i can go to instance templates and create it
instance templates and create it now before that what i would do is i
now before that what i would do is i would go into the instance which is
would go into the instance which is already running
already running and copy the startup script for it
and copy the startup script for it so if you scroll down and go to the
so if you scroll down and go to the metadata part of it
metadata part of it and go to custom metadata this is where
and go to custom metadata this is where you can see the startup script
you can see the startup script what i would do is i would want to use
what i would do is i would want to use this startup script so i'll copy this
this startup script so i'll copy this you can also copy it and paste it to a
you can also copy it and paste it to a text file so that we can reuse it
text file so that we can reuse it multiple times
multiple times i would go to nav instance templates and
i would go to nav instance templates and we don't create an instance template so
we don't create an instance template so create
create new instance template
i would call this my instance template with startup script
with startup script you can see that i don't really need to
you can see that i don't really need to specify a region or a zone
specify a region or a zone when i'm creating an instance template
when i'm creating an instance template because instance template can be used to
because instance template can be used to create
create resources in different regions and
resources in different regions and different zones that's the reason why we
different zones that's the reason why we don't need to configure a region or a
don't need to configure a region or a zone
zone i'll choose the default machine type
i'll choose the default machine type which is recommended i'll choose the
which is recommended i'll choose the default boot disk which is recommended
default boot disk which is recommended and i'll say i love http traffic
and i'll say i love http traffic and i'll go into management security
and i'll go into management security disks and networking this would be the
disks and networking this would be the same as what we would have when we
same as what we would have when we configure a virtual machine
configure a virtual machine and over here i would go and configure a
and over here i would go and configure a startup script so this is the same thing
startup script so this is the same thing that we configured
that we configured earlier and let's go ahead and
earlier and let's go ahead and say create
there is no cost associated with creating an instance template
creating an instance template however when we create instances using
however when we create instances using the instance template then we would need
the instance template then we would need to pay for it
to pay for it now let's try and create an instance
now let's try and create an instance with this specific instance template all
with this specific instance template all that i need to do is to click this
that i need to do is to click this and say create vm
and on the next page you would see that all the details that we configured
all the details that we configured earlier
earlier are pre-populated you can choose the
are pre-populated you can choose the region and zone however you'd see that
region and zone however you'd see that all the
all the things like machine configuration the
things like machine configuration the boot disk
boot disk these are pre-populated with the values
these are pre-populated with the values we chose
we chose when we were creating the template you
when we were creating the template you can see that the firewall is
can see that the firewall is automatically configured to allow http
automatically configured to allow http traffic
traffic and if you click on management you'd see
and if you click on management you'd see that the startup script is already
that the startup script is already populated in here
populated in here you can customize this further if you
you can customize this further if you don't but ideally what you need to do is
don't but ideally what you need to do is to
to use a instance template and then
use a instance template and then directly go ahead and create a instance
directly go ahead and create a instance you can see that now a new instance is
you can see that now a new instance is being created using the
being created using the instance template now you can use this
instance template now you can use this instance template to create as many
instance template to create as many instances
instances that you'd want let's go back to vm
that you'd want let's go back to vm instances
instances i don't really need the my vm with
i don't really need the my vm with startup script anymore so let's go ahead
startup script anymore so let's go ahead and delete that
and delete that so i've selected this and let's go ahead
so i've selected this and let's go ahead and delete it
and delete it so this would delete the myvm with
so this would delete the myvm with startup script the only vm that would be
startup script the only vm that would be running right now is the one which was
running right now is the one which was created using my instance template with
created using my instance template with startup script
startup script you can see that the name of that
you can see that the name of that specific instance is the name of the
specific instance is the name of the template
template appended with a numeral so it's hyphen 1
appended with a numeral so it's hyphen 1 in here and you can see that this is
in here and you can see that this is assigned a external ip
assigned a external ip let's click that and you can see that
let's click that and you can see that hello world is coming from my instance
hello world is coming from my instance template with startup script 1
template with startup script 1 and the internal ip10 12804
and the internal ip10 12804 let's make sure that this is the right
let's make sure that this is the right instance yep in the last few steps
instance yep in the last few steps we saw how we can simplify the creation
we saw how we can simplify the creation of vm instances and also set up some
of vm instances and also set up some software on it
software on it we started with the manual approach
we started with the manual approach where we created a vm instance
where we created a vm instance we ssh into it and then set up the
we ssh into it and then set up the software using a few commands
software using a few commands after that we made use of a startup
after that we made use of a startup script enough we have a template
script enough we have a template and now with the template it's very easy
and now with the template it's very easy you can use the template and launch
you can use the template and launch new instances at will i'm sure you're
new instances at will i'm sure you're having an interesting time and i'll see
having an interesting time and i'll see you in the next step
welcome back in previous steps we saw how we can simplify the creation
we saw how we can simplify the creation of virtual machine and setting up
of virtual machine and setting up software on it
software on it using a instance template however there
using a instance template however there is one more problem with the approach
is one more problem with the approach that we took
that we took installing os patches and software at
installing os patches and software at the launch of vm instances
the launch of vm instances increases boot up time so whenever we
increases boot up time so whenever we create a instance if you are installing
create a instance if you are installing a lot of software or a lot of os patches
a lot of software or a lot of os patches then it takes a lot of time to launch
then it takes a lot of time to launch that vm instance
that vm instance how can we avoid that one of the
how can we avoid that one of the approaches that we can take
approaches that we can take is to create a custom image with os
is to create a custom image with os patches
patches and the software pre-installed so we can
and the software pre-installed so we can create an instance
create an instance we can create a custom image out of it
we can create a custom image out of it and
and we can create further instances using
we can create further instances using that custom image
that custom image in google cloud you can actually create
in google cloud you can actually create a custom image in a number of
a custom image in a number of ways a little later in the course we
ways a little later in the course we look at what is a persistent disk
look at what is a persistent disk and what is a snapshot whenever we
and what is a snapshot whenever we attach a hard disk with the instance
attach a hard disk with the instance what we are attaching is a persistent
what we are attaching is a persistent disk
disk and a snapshot is nothing but a copy of
and a snapshot is nothing but a copy of a persistent disk
a persistent disk you can create a custom image from
you can create a custom image from either a vm instance
either a vm instance a persistent disk a snapshot another
a persistent disk a snapshot another image
image or a little later we'll also talk about
or a little later we'll also talk about cloud storage
cloud storage cloud storage is an object storage which
cloud storage is an object storage which is provided by google cloud
is provided by google cloud you can also store a file in cloud
you can also store a file in cloud storage and create an image from it
storage and create an image from it we'll discuss this a little bit more
we'll discuss this a little bit more when we talk about persistent disk and
when we talk about persistent disk and snapshots
snapshots for enough what we would do is we would
for enough what we would do is we would actually create a image
actually create a image from an existing compute engine instance
from an existing compute engine instance once you create a custom image you can
once you create a custom image you can actually share it across
actually share it across projects google cloud also provides the
projects google cloud also provides the feature
feature to deprecate old images so whenever you
to deprecate old images so whenever you create an
create an image and let's say over a period of
image and let's say over a period of time it has become an old image and you
time it has become an old image and you don't want anybody to use it
don't want anybody to use it then you can mark it as deprecated along
then you can mark it as deprecated along with marking it as dedicated you can
with marking it as dedicated you can also say this is the new recommended
also say this is the new recommended image
image so the recommendation is whenever you
so the recommendation is whenever you are creating a new custom image
are creating a new custom image and the old one is outdated go ahead and
and the old one is outdated go ahead and mark the old one
mark the old one as deprecated one of the advantages
as deprecated one of the advantages of actually creating a custom image is
of actually creating a custom image is to ensure
to ensure that all your corporate security
that all your corporate security standards are
standards are incorporated into the image what you can
incorporated into the image what you can do is you can actually create
do is you can actually create a vm instance which adheres to all your
a vm instance which adheres to all your corporate security standards and from
corporate security standards and from that
that you can actually create a image this
you can actually create a image this process of doing this
process of doing this is called hardening a image creating an
is called hardening a image creating an image which
image which adheres to all your security standards
adheres to all your security standards once you have a hard end image
once you have a hard end image you can use that to create secure vm
you can use that to create secure vm instances
instances the next recommendation is to prefer
the next recommendation is to prefer using custom image
using custom image to start up scripts startup scripts
to start up scripts startup scripts include the boot up time
include the boot up time and therefore it's recommended to
and therefore it's recommended to actually create a custom image
actually create a custom image let's now see how to create a custom
let's now see how to create a custom image and
image and let's see how you can use that in an
let's see how you can use that in an instance template
instance template i have one vm instance which is running
i have one vm instance which is running right now that's vm
right now that's vm my instance template with startup script
my instance template with startup script one if i minimize this
one if i minimize this and actually expand storage this is
and actually expand storage this is where you can see
where you can see disks so this is the this are nothing
disks so this is the this are nothing but the hard disks which
but the hard disks which are associated with your virtual machine
are associated with your virtual machine whenever you create
whenever you create a virtual machine the operating system
a virtual machine the operating system of the virtual machine
of the virtual machine runs on a hard disk which is attached
runs on a hard disk which is attached with that specific virtual machine
with that specific virtual machine and that's what you are seeing in here
and that's what you are seeing in here you can see this specific disk which is
you can see this specific disk which is attached
attached with our virtual machine you can see
with our virtual machine you can see that it also has the same name
that it also has the same name my instance template with startup script
my instance template with startup script 1 and you can see that by default
1 and you can see that by default it has a size of about 10 gb now we want
it has a size of about 10 gb now we want to create a
to create a image we want to create a copy of this
image we want to create a copy of this specific disk
specific disk how can we create an image from the
how can we create an image from the specific disk the way you can do that
specific disk the way you can do that is by going to actions and clicking
is by going to actions and clicking create image so we go ahead and say
create image so we go ahead and say create image
create image you can see that the source of this
you can see that the source of this specific image is a disk the name of the
specific image is a disk the name of the disk is present in here
disk is present in here and if you scroll down you can also
and if you scroll down you can also choose the location do you want
choose the location do you want this image to be stored multi-regionally
this image to be stored multi-regionally or regionally
or regionally if you expect this image to be used in
if you expect this image to be used in other regions
other regions then you can go with multi-regional if
then you can go with multi-regional if you are expecting this image to be used
you are expecting this image to be used only in a specific region then you can
only in a specific region then you can go for regional what i would do is i
go for regional what i would do is i would leave it at the default
would leave it at the default multi-regional i'll take the default for
multi-regional i'll take the default for rest of the things including encryption
rest of the things including encryption and i would go ahead and say create when
and i would go ahead and say create when i go ahead and say create
i go ahead and say create there is an error which pops up the
there is an error which pops up the reason for the error is because
reason for the error is because the disk is now attached to a running
the disk is now attached to a running instance
instance the recommendation is that you should
the recommendation is that you should never create
never create a image from a disk which is connected
a image from a disk which is connected to a running instance
to a running instance you should always stop the instance and
you should always stop the instance and then create
then create a image from that specific disk so what
a image from that specific disk so what we would do is actually go in
we would do is actually go in and go to the virtual machine instances
and go to the virtual machine instances open it in new tab
open it in new tab and you can go in here and select this
and you can go in here and select this and i would want to actually
and i would want to actually stop this so we are stopping the virtual
stop this so we are stopping the virtual machine instance
machine instance let's wait for it to be stopped you can
let's wait for it to be stopped you can check this checkbox
check this checkbox and take a image without stopping the
and take a image without stopping the instance
instance however that is not really recommended
however that is not really recommended and that's the reason why we have
and that's the reason why we have started to stop the instance
started to stop the instance and you can see that the instance is not
and you can see that the instance is not stopped and i would go ahead and now say
stopped and i would go ahead and now say take a copy let's say create
take a copy let's say create oops it's not discovering the fact that
oops it's not discovering the fact that it's stopped so let's do a cancel
it's stopped so let's do a cancel let's go back to disks
and let's now try to create the image again so let's say create image
again so let's say create image i'll call this my
i'll call this my custom image
i'll choose the same options that we chose earlier and say create
chose earlier and say create now because the instance is stopped it
now because the instance is stopped it would go ahead and create that specific
would go ahead and create that specific image
image the creation of the image would take a
the creation of the image would take a little while
little while so it's going to the list of images you
so it's going to the list of images you can see all the
can see all the public images which are present in here
public images which are present in here the one which we have created just now
the one which we have created just now is a private image
is a private image if you wait for a few minutes and do a
if you wait for a few minutes and do a refresh then you'd see
refresh then you'd see our specific image come up in here you
our specific image come up in here you can see that my custom image is present
can see that my custom image is present in here
in here and within a couple of minutes you would
and within a couple of minutes you would see that the status of it is
see that the status of it is ready to use now i can go ahead and use
ready to use now i can go ahead and use this to create
this to create a vm instance so what i would need to do
a vm instance so what i would need to do now
now is go ahead and say create instance
is go ahead and say create instance or the other option is actually i can
or the other option is actually i can create a
create a instance template based on this specific
instance template based on this specific image as well
image as well so i can go into virtual machines
so i can go into virtual machines and let's go to instance templates
and let's go to instance templates and what we want to do is to actually
and what we want to do is to actually use this instance template and make a
use this instance template and make a copy
copy so i'll take the copy of the existing
so i'll take the copy of the existing instance template so
instance template so i'll say copy
so it would copy everything from the earlier instance template i've now
earlier instance template i've now renamed this to
renamed this to my instance template with image
my instance template with image or i would say with custom image
or i would say with custom image and i would go in over here i take the
and i would go in over here i take the same
same machine family as earlier the boot disk
machine family as earlier the boot disk i want to change this so instead of
i want to change this so instead of debian i want to use my custom image
debian i want to use my custom image so i would go in here and click custom
so i would go in here and click custom images
images and select the image
so if you wait for a little while my custom image should appear in here
custom image should appear in here and you can say select
and once you select that you can go into management security disks networking
management security disks networking and stuff and over here in the startup
and stuff and over here in the startup script
script you don't really need to do the install
you don't really need to do the install all that you need to do is to
all that you need to do is to create the html file because you would
create the html file because you would want to put
want to put host specific information in there and
host specific information in there and once you create the html file you also
once you create the html file you also want to start up the server
want to start up the server so you want to start up apache the way
so you want to start up apache the way we can do that is by just saying service
we can do that is by just saying service apache to start
apache to start so we are populating the html file and
so we are populating the html file and then we are starting up the web server
then we are starting up the web server we don't really need to install apache
we don't really need to install apache anymore because
anymore because it's already part of the image so this
it's already part of the image so this would create a instance template
would create a instance template this is using the custom image that we
this is using the custom image that we created just now
created just now and using this instance template you can
and using this instance template you can actually launch as many instances
actually launch as many instances as you would want and these instances
as you would want and these instances would be created with the custom image
would be created with the custom image that we created
that we created i can go ahead and create a instance
i can go ahead and create a instance using this particular
using this particular virtual machines also create virtual
virtual machines also create virtual machine
machine i'll take all the defaults which are
i'll take all the defaults which are suggested and say create
suggested and say create and while the new instance is being
and while the new instance is being created what i would do is i would
created what i would do is i would delete the old instance which was
delete the old instance which was created
created with this startup script so i'll go
with this startup script so i'll go ahead and delete that i don't really
ahead and delete that i don't really need that anymore
my instance template with custom image one is now ready
one is now ready give it a couple of minutes and then go
give it a couple of minutes and then go ahead and click external ip
ahead and click external ip and then you should see my instance
and then you should see my instance template with custom image 1
template with custom image 1 10.128.0.5 and you can see that this is
10.128.0.5 and you can see that this is the internal ip of this specific
the internal ip of this specific one so you can see that over the last
one so you can see that over the last few steps we understood a lot about
few steps we understood a lot about virtual machines we were playing with
virtual machines we were playing with the life cycle of the virtual machines
the life cycle of the virtual machines which
which to stop start delete them we also played
to stop start delete them we also played with instance templates
with instance templates and we also played with images
and we also played with images welcome back in this step let's try and
welcome back in this step let's try and understand how to debug
understand how to debug problems if you have problems installing
problems if you have problems installing the apache web server
the apache web server or running this specific url now let's
or running this specific url now let's say you went through all these steps
say you went through all these steps but you are not able to see this url
but you are not able to see this url launch
launch up you have used the external ip which
up you have used the external ip which is present for the instance
is present for the instance and let's say you are running it and you
and let's say you are running it and you are still having a problem
are still having a problem what are the things that you would want
what are the things that you would want to check number one make sure that you
to check number one make sure that you are using the external ip of the running
are using the external ip of the running instance
instance if i refresh the vm page this is where i
if i refresh the vm page this is where i can see the external ip make sure that
can see the external ip make sure that you click that
you click that and open it in a new window so that's
and open it in a new window so that's number one so make sure that you're
number one so make sure that you're using the right
using the right url if you are sure that you are using
url if you are sure that you are using the right url then what you can do is go
the right url then what you can do is go and ssh into it
and ssh into it make sure that you are able to ssh into
make sure that you are able to ssh into it if you are able to ssh into it
it if you are able to ssh into it then make sure that your apache web
then make sure that your apache web server is properly
server is properly installed i can do an ls and
installed i can do an ls and look at slash wire slash www
look at slash wire slash www slash html so ls slash bar slash
slash html so ls slash bar slash www.html
www.html and what do i see i see a index.html
and what do i see i see a index.html file
file which is present in here now i would
which is present in here now i would want to see what is the content which is
want to see what is the content which is preset in this specific file
preset in this specific file so i'll say cat slashware slash www
so i'll say cat slashware slash www slash html slash index
slash html slash index dot html
what would it show it shows the content of this specific file
of this specific file you can see that the content of this
you can see that the content of this specific file is what i am seeing
specific file is what i am seeing on the web browser so make sure that
on the web browser so make sure that this file
this file is present and it has the right content
is present and it has the right content that you would want to see
that you would want to see once you make sure that the file is
once you make sure that the file is there and the content is fine as well
there and the content is fine as well what you can also do is to make sure
what you can also do is to make sure that the apache service is started up
that the apache service is started up fine so you can type in
fine so you can type in service apache to
service apache to space start before we'd be able to do
space start before we'd be able to do a service apache to start i would
a service apache to start i would actually need to do a sudo su
actually need to do a sudo su so i'll do a sudo su and then i would do
so i'll do a sudo su and then i would do a service
apache to start
and this would ensure that the apache server is also started up
server is also started up and after this you can actually go and
and after this you can actually go and check if your url is working
check if your url is working if your url is still not working there
if your url is still not working there is one more thing that you can check
is one more thing that you can check which is to click this vm instance
which is to click this vm instance so open the vm instance app and if you
so open the vm instance app and if you scroll further down you should see
scroll further down you should see firewalls and in the firewalls
firewalls and in the firewalls you should see i love http traffic
you should see i love http traffic checked if you don't see this checked
checked if you don't see this checked then you can actually edit this and
then you can actually edit this and check that so if you say edit
check that so if you say edit you can go in here check this check box
you can go in here check this check box and make sure that you save it
and make sure that you save it once you save the vm instance you can go
once you save the vm instance you can go and click the external ip of it
and click the external ip of it and you should see the page come up in
and you should see the page come up in this video we looked at how you can
this video we looked at how you can debug problems with installing the
debug problems with installing the apache web server on a vm instance
apache web server on a vm instance i'm sure you're having an interesting
i'm sure you're having an interesting time and i'll see you in the next step
welcome back let's take a step back and look at the entire interface which is
look at the entire interface which is offered by google cloud platform web
offered by google cloud platform web console
console this is also called just the console
this is also called just the console whenever people say
whenever people say console then they are referring to this
console then they are referring to this specific thing
specific thing and over here the most important thing
and over here the most important thing is the pencil which is present in here
is the pencil which is present in here you can go in here and access the
you can go in here and access the different services which are present in
different services which are present in here
here the other way you can access the
the other way you can access the services is the way we have been doing
services is the way we have been doing until now so let's say i would want to
until now so let's say i would want to access kubernetes engine i can type in
access kubernetes engine i can type in kubernetes in here
kubernetes in here or i can go to the pencil and i'll i can
or i can go to the pencil and i'll i can navigate to
navigate to kubernetes it would be under compute and
kubernetes it would be under compute and then i can go in
then i can go in and access that specific service the
and access that specific service the interesting thing about
interesting thing about using the pencil is that whenever you
using the pencil is that whenever you want to actually make mark
want to actually make mark anything as favorite you can actually
anything as favorite you can actually pin it maybe
pin it maybe i'll be playing with compute engine a
i'll be playing with compute engine a lot then i can go ahead and pin this
lot then i can go ahead and pin this so then what would happen is compute
so then what would happen is compute engine would come up in here
engine would come up in here so when i click my navigation menu i can
so when i click my navigation menu i can see compute engine right at the top
see compute engine right at the top so if you're playing with any service a
so if you're playing with any service a lot then you can make use of this
lot then you can make use of this feature
feature and you can directly access your vm
and you can directly access your vm instances
instances now let's see what's under home under
now let's see what's under home under home you can see
home you can see dashboard dashboard is the screen which
dashboard dashboard is the screen which we saw
we saw when we first came to google cloud it
when we first came to google cloud it contains the project information
contains the project information it contains different apis that we are
it contains different apis that we are making use of
making use of you can see that we are making use of a
you can see that we are making use of a lot of api calls
lot of api calls whenever we create resources a lot of
whenever we create resources a lot of apis are called
apis are called and that's the resources that we are
and that's the resources that we are seeing in here over here you can also
seeing in here over here you can also see this current status of the google
see this current status of the google cloud platform you can see that all the
cloud platform you can see that all the services are normal right now
services are normal right now you can also see the billing information
you can also see the billing information and if you scroll down you'll also see a
and if you scroll down you'll also see a lot
lot of information around monitoring and
of information around monitoring and error reporting another thing you'd see
error reporting another thing you'd see in here is activity
in here is activity if you go to activity you'd see a lot of
if you go to activity you'd see a lot of information about what you have been
information about what you have been doing
doing until now so over here you can see that
until now so over here you can see that i have been doing a lot of activities
i have been doing a lot of activities creating and deleting vms and playing
creating and deleting vms and playing around with them
around with them so you can see that and if you want you
so you can see that and if you want you can go ahead and filter
can go ahead and filter among the activities so you can go to
among the activities so you can go to the activity type
the activity type and select what kind of activities you
and select what kind of activities you are interested in configuration
are interested in configuration data access development or monitoring
data access development or monitoring you can also choose which type of
you can also choose which type of resources you would want to focus on
resources you would want to focus on you can see that almost 75 different
you can see that almost 75 different types of resources are selected in here
types of resources are selected in here by default you can
by default you can choose whichever one you'd want to look
choose whichever one you'd want to look at the last tab which is present in here
at the last tab which is present in here is recommendations
is recommendations google cloud would automatically analyze
google cloud would automatically analyze your cloud usage
your cloud usage and if they have any recommendations
and if they have any recommendations they would show them
they would show them in here as of now as you can see there
in here as of now as you can see there are no recommendations for me
are no recommendations for me other than that if you click the pencil
other than that if you click the pencil and go on the left hand side you can see
and go on the left hand side you can see all the services which are present in
all the services which are present in here
here right so you can see compute services
right so you can see compute services you can see compute services on the left
you can see compute services on the left hand side
hand side a lot of them in here you can also see
a lot of them in here you can also see different
different you can see storage services database
you can see storage services database services you can see the networking
services you can see the networking services which are present in here
services which are present in here and there are also other services to
and there are also other services to support your operations and there are a
support your operations and there are a few tools
few tools and you'll also see services to help you
and you'll also see services to help you with big data
with big data and artificial intelligence as you can
and artificial intelligence as you can see in here this is the project which we
see in here this is the project which we are working in
are working in my first project if you want you can
my first project if you want you can actually create a new project
actually create a new project and create resources under that specific
and create resources under that specific project as well
project as well for enough let's keep using my first
for enough let's keep using my first project which is the default project
project which is the default project which was created for us
which was created for us other than that in the top menu you can
other than that in the top menu you can also see your free trial status if you
also see your free trial status if you click this you can see
click this you can see how much of your free trial credit is
how much of your free trial credit is remaining and how many days are
remaining and how many days are remaining in your free trial
remaining in your free trial you can get help by clicking this
you can get help by clicking this question mark in here
question mark in here and if there are any notifications you
and if there are any notifications you can see them in here
can see them in here there are notifications created whenever
there are notifications created whenever you
you create or delete or update a instance
create or delete or update a instance there will be notifications created for
there will be notifications created for that and you can
that and you can click this three dots in here to look at
click this three dots in here to look at a few more
a few more settings if you go in here and go over
settings if you go in here and go over to project settings
to project settings you'll be able to see the settings for
you'll be able to see the settings for our current
our current project the idea behind this step was to
project the idea behind this step was to quickly navigate around
quickly navigate around and play around with the cloud console
and play around with the cloud console so that you are familiar with it
so that you are familiar with it when you keep using it during this
when you keep using it during this specific course
specific course what i'll do now is i'll go ahead and
what i'll do now is i'll go ahead and click dismiss over here
click dismiss over here and i'll see you in the next step
welcome back until now we have been playing with
playing with virtual machines starting this step
virtual machines starting this step let's look at a few
let's look at a few important things that you need to
important things that you need to understand about keeping your costs
understand about keeping your costs low whenever you're making use of the
low whenever you're making use of the cloud you'd want to keep your costs
cloud you'd want to keep your costs as low as possible what are the things
as low as possible what are the things that you can do
that you can do to keep the to keep the cost of your
to keep the to keep the cost of your virtual machines
virtual machines low the first thing that we would be
low the first thing that we would be talking about is
talking about is sustained use discounts what is a
sustained use discounts what is a sustained use discount
sustained use discount it's an automatic discount which is
it's an automatic discount which is applied for running vm instances
applied for running vm instances for significant portion of the billing
for significant portion of the billing month
month for example if you are using n1 or n2
for example if you are using n1 or n2 machine types
machine types for more than 25 percent of the time
for more than 25 percent of the time period of the month
period of the month and then you get about 20 to 50 discount
and then you get about 20 to 50 discount on
on every incremental minute so beyond 25
every incremental minute so beyond 25 percent
percent whatever time period you are running for
whatever time period you are running for you would get a discount on it
you would get a discount on it and the discount increases with the
and the discount increases with the usage
usage if you are using the vm for eighty
if you are using the vm for eighty percent of the month
percent of the month the amount of discount you would get
the amount of discount you would get would be higher than
would be higher than the amount you would get if you are
the amount you would get if you are running it for forty percent
running it for forty percent and the great thing about the sustained
and the great thing about the sustained use discounts is that you don't really
use discounts is that you don't really need to do
need to do anything there is nothing you need to do
anything there is nothing you need to do specifically for this when you are
specifically for this when you are creating or running your virtual
creating or running your virtual machines
machines this is automatically applied by the
this is automatically applied by the platform itself
platform itself however there are a few important
however there are a few important restrictions that you need to remember
restrictions that you need to remember a little later in the course we'll be
a little later in the course we'll be also talking about google kubernetes
also talking about google kubernetes engine
engine which is a managed kubernetes service
which is a managed kubernetes service which is provided by google cloud
which is provided by google cloud platform
platform whenever you are creating instances
whenever you are creating instances using the google compute engine that's
using the google compute engine that's basically what we are using in the
basically what we are using in the course until now
course until now or whenever you create instances using
or whenever you create instances using google kubernetes engine
google kubernetes engine the sustained use discounts are
the sustained use discounts are automatically applied
automatically applied remember that this does not apply on
remember that this does not apply on certain machine types
certain machine types for example e2 and a2 the sustained
for example e2 and a2 the sustained use discounts do not apply for them and
use discounts do not apply for them and also remember
also remember that if you are using app engine
that if you are using app engine flexible or data flow
flexible or data flow to create the vms sustained use
to create the vms sustained use discounts do not apply
discounts do not apply we will talk about app engine and data
we will talk about app engine and data flow as we go further in this course
flow as we go further in this course the important thing to remember about
the important thing to remember about sustained use discounts is the fact that
sustained use discounts is the fact that these are automatically applied when you
these are automatically applied when you use instances which are created by
use instances which are created by google kubernetes engine
google kubernetes engine and compute engine for a significant
and compute engine for a significant part of
part of a specific month also remember that
a specific month also remember that there are a few
there are a few restrictions i'm sure you're having an
restrictions i'm sure you're having an interesting time and i'll see you in the
interesting time and i'll see you in the next step
welcome back in this step let's look at another type of discounts which are
another type of discounts which are applied on your virtual machines
applied on your virtual machines however this type of discounts need a
however this type of discounts need a commitment from you
commitment from you and that's the reason why these are
and that's the reason why these are called committed use discounts
called committed use discounts using committed use discounts is
using committed use discounts is recommended for workloads with
recommended for workloads with predictable
predictable resource needs you can say i would need
resource needs you can say i would need a virtual machine
a virtual machine of this type for one year or three years
of this type for one year or three years and depending on the machine type and
and depending on the machine type and the gpus you are asking for
the gpus you are asking for you can get up to 70 discount the
you can get up to 70 discount the discount that you would get with
discount that you would get with committed use discount is higher
committed use discount is higher than the discount that you would get
than the discount that you would get with sustained use discounts
with sustained use discounts so if you are sure that you need a
so if you are sure that you need a specific virtual machine for one year
specific virtual machine for one year or three years then it makes sense to go
or three years then it makes sense to go ahead and register for a committed use
ahead and register for a committed use discount
discount because this gives you more discount
because this gives you more discount than depending on a sustained use
than depending on a sustained use discount
discount again the committed use discount is
again the committed use discount is applicable for instances which are
applicable for instances which are created by google kubernetes engine
created by google kubernetes engine and compute engine and and the same
and compute engine and and the same restriction that we talked about when we
restriction that we talked about when we talked about sustained use discounts
talked about sustained use discounts applies for committed use discounts as
applies for committed use discounts as well this does not apply for vms created
well this does not apply for vms created by app engine flexible
by app engine flexible and data flow now how can you ask for a
and data flow now how can you ask for a committed use discount
committed use discount let's go back to our virtual machines
let's go back to our virtual machines and in the menu for virtual machines the
and in the menu for virtual machines the last option you would see is committed
last option you would see is committed use discounts
use discounts this is where you can actually go in and
this is where you can actually go in and ask for a committed use discount
ask for a committed use discount this is where you can actually go in and
this is where you can actually go in and purchase a commitment
purchase a commitment so i can go ahead and say purchase a
so i can go ahead and say purchase a commitment
and i can say i want to purchase a specific
specific commitment as you can see in here you
commitment as you can see in here you can actually purchase a hardware or a
can actually purchase a hardware or a software
software commitment what we are interested in is
commitment what we are interested in is a virtual machine commitment which is a
a virtual machine commitment which is a hardware commitment
hardware commitment so you can give it a name you can choose
so you can give it a name you can choose which region you would want to have the
which region you would want to have the commitment in
commitment in and you can choose the specific family
and you can choose the specific family you'd want to commit on
you'd want to commit on and then you can specify how much
and then you can specify how much duration you want to commit on
duration you want to commit on you can also specify a little bit about
you can also specify a little bit about the configuration of the machine you
the configuration of the machine you want
want do you want course do you want memory do
do you want course do you want memory do you want gpus do you want
you want gpus do you want local ssds and then you can go ahead and
local ssds and then you can go ahead and click purchase
click purchase i'm not going to click purchase in here
i'm not going to click purchase in here because i don't really want to commit on
because i don't really want to commit on it
it what i would do is i'll go ahead and say
what i would do is i'll go ahead and say cancel once you register a commitment if
cancel once you register a commitment if you create any new instances of that
you create any new instances of that type
type the discount is automatically applied in
the discount is automatically applied in this step we talked about committed use
this step we talked about committed use discounts
discounts these are recommended for workloads with
these are recommended for workloads with predictable resource
predictable resource needs you know ahead of time that i
needs you know ahead of time that i would want to run a web application
would want to run a web application for a long time in those kind of
for a long time in those kind of situations
situations you can get the best discounts by going
you can get the best discounts by going for a committed use discount
for a committed use discount i'll see you in the next step
welcome back in step let's talk about pre-emptible virtual machines what are
pre-emptible virtual machines what are preemptible virtual machines
preemptible virtual machines preemptive virtual machines are
preemptive virtual machines are short-lived cheaper
short-lived cheaper compute instances if you are aware of
compute instances if you are aware of aws
aws then pmt build vms are very very similar
then pmt build vms are very very similar to spot instances
to spot instances the preemptible instances can be stopped
the preemptible instances can be stopped by gcp
by gcp anytime within 24 hours
anytime within 24 hours the maximum time that you can run a
the maximum time that you can run a preemptable instance typically
preemptable instance typically is 24 hours and you need to remember
is 24 hours and you need to remember that gcp can terminate this instance
that gcp can terminate this instance any time within the 24 hours period as
any time within the 24 hours period as well
well just before gcp terminates your instance
just before gcp terminates your instance you will get a 30 second
you will get a 30 second warning you can use this time period to
warning you can use this time period to save anything you might want to save
save anything you might want to save now when do you go for a preemptable vms
now when do you go for a preemptable vms you'd use a preemptable vm
you'd use a preemptable vm if your applications are fall tolerant
if your applications are fall tolerant you can stop and start them at any point
you can stop and start them at any point in time
in time and you are very very sensitive you want
and you are very very sensitive you want to run the workload with minimum cost
to run the workload with minimum cost and your workload is not immediate
and your workload is not immediate if your users are accessing a specific
if your users are accessing a specific application then your workload is
application then your workload is immediate you would want to run that
immediate you would want to run that immediately however if you have batch
immediately however if you have batch programs which you can run let's say
programs which you can run let's say within the next 15 days or within the
within the next 15 days or within the next month those are good workloads
next month those are good workloads where you can go for preemptable vms so
where you can go for preemptable vms so a good example is non-immediate
a good example is non-immediate batch processing jobs now let's look at
batch processing jobs now let's look at a few restrictions
a few restrictions preemptable vms might not always be
preemptable vms might not always be available
available number two there is no sla that is
number two there is no sla that is guaranteed by google cloud platform
guaranteed by google cloud platform and your preemptable vms cannot be
and your preemptable vms cannot be migrated to a regular vm you cannot
migrated to a regular vm you cannot convert
convert a preemptable vm into a regular vm
a preemptable vm into a regular vm and number three is you cannot
and number three is you cannot automatically restart them
automatically restart them if they are stopped due to any reason
if they are stopped due to any reason you cannot actually restart them again
you cannot actually restart them again and the last but very important one as
and the last but very important one as far as this course is concerned is
far as this course is concerned is free tire credits are not applicable for
free tire credits are not applicable for launching preemptable vms
launching preemptable vms so i would recommend you to not launch
so i would recommend you to not launch preemptable vms at all
preemptable vms at all now let's try and see how you can
now let's try and see how you can actually launch a preemptible vm
actually launch a preemptible vm we're not going to launch it we're just
we're not going to launch it we're just going to see where you can actually
going to see where you can actually launch it
launch it so i'm going to vm instances and
so i'm going to vm instances and you can go and say create and
you can go and say create and this is the typical configuration we do
this is the typical configuration we do now where can i do preemptable instance
now where can i do preemptable instance the place where you can configure that
the place where you can configure that is in management security disk
is in management security disk networking and sole tenancy if you go
networking and sole tenancy if you go further down
further down if you go to the availability policy
if you go to the availability policy that is where you can actually configure
that is where you can actually configure the preemptibility
the preemptibility a preemptable vm costs much less but
a preemptable vm costs much less but lasts
lasts only 24 hours it can be terminated
only 24 hours it can be terminated sooner
sooner due to system demands and this is where
due to system demands and this is where you can actually
you can actually set it to on if you set preemptibility
set it to on if you set preemptibility to on and launch an instance then it
to on and launch an instance then it becomes a
becomes a preemptable instance in this step
preemptable instance in this step we looked at preemptable vms these are
we looked at preemptable vms these are short-lived
short-lived very very cheap compute instances which
very very cheap compute instances which you can use
you can use to run non-immediate fault tolerant
to run non-immediate fault tolerant workloads
workloads if you have a non-immediate batch
if you have a non-immediate batch program that you would want to run
program that you would want to run at a very very low cost then you can opt
at a very very low cost then you can opt for
for a preemptible vm i'm sure you're having
a preemptible vm i'm sure you're having a wonderful time and i'll see you in the
a wonderful time and i'll see you in the next step
welcome back in the last few steps we were talking about
were talking about a few discounts that are applicable for
a few discounts that are applicable for your google compute
your google compute engine in this step let's look at a few
engine in this step let's look at a few more important things around building of
more important things around building of your compute engine
your compute engine it is very important to remember that
it is very important to remember that you are built for compute engine
you are built for compute engine by the second however this is only after
by the second however this is only after a minimum of one minute so if you start
a minimum of one minute so if you start a new vm instance you will pay for a
a new vm instance you will pay for a minimum of one minute
minimum of one minute and thereafter you'll be billed by the
and thereafter you'll be billed by the second
second whenever you stop a compute engine
whenever you stop a compute engine instance you are not built for
instance you are not built for compute however remember that if you
compute however remember that if you have any storage that is attached with
have any storage that is attached with the compute instance
the compute instance you'd still be billed for it the first
you'd still be billed for it the first recommendation when it comes to reducing
recommendation when it comes to reducing your billing
your billing is to always create budget alerts how
is to always create budget alerts how can you create budget alerts
can you create budget alerts if you go over to the navigation menu on
if you go over to the navigation menu on the left hand side you should see
the left hand side you should see something called billing
something called billing and in billing you should see budgets
and in billing you should see budgets and alerts
and alerts if you click that you'd be landing on
if you click that you'd be landing on this specific
this specific screen where you can actually create a
screen where you can actually create a budget
budget award surprises on your bill by creating
award surprises on your bill by creating budgets
budgets to monitor all your google cloud charges
to monitor all your google cloud charges at one place
at one place after you set a budget you can create
after you set a budget you can create budget alerts
budget alerts to email billing admins and users when
to email billing admins and users when charges exceed a certain amount
charges exceed a certain amount so go ahead and create a budget let's
so go ahead and create a budget let's create a budget right now
create a budget right now create a budget and i would call this
create a budget and i would call this budget as
budget as my first
my first budget and i'll choose the defaults
budget and i'll choose the defaults which are suggested for me
which are suggested for me so i'll choose all projects all services
so i'll choose all projects all services and i would say next
and i would say next and over here i can specify a target
and over here i can specify a target amount
amount i'll say the target amount for me is
i'll say the target amount for me is let's keep it as low as possible so
let's keep it as low as possible so let's just say i would say target budget
let's just say i would say target budget is 10 rupees
and i would go ahead and click next and if you click next you would see
and if you click next you would see alert threshold
alert threshold rules so you can configure alerts
rules so you can configure alerts at different thresholds you can see that
at different thresholds you can see that the defaults which are suggested are
the defaults which are suggested are get an alert when 50 of the budget is
get an alert when 50 of the budget is utilized which is 5 rupees
utilized which is 5 rupees get an alert when ninety percent of the
get an alert when ninety percent of the budget is utilized and also when hundred
budget is utilized and also when hundred percent of the
percent of the budget is utilized you can further
budget is utilized you can further customize these thresholds if you
customize these thresholds if you want and if you scroll down you can
want and if you scroll down you can configure
configure the notifications as well so make sure
the notifications as well so make sure that you check this
that you check this up so email alerts to billing admins and
up so email alerts to billing admins and users
users this would ensure that you get an email
this would ensure that you get an email when the cost exceeds
when the cost exceeds your limits and at the end of that you
your limits and at the end of that you can go ahead and click finish
can go ahead and click finish now the other thing that you can do in
now the other thing that you can do in addition to creating a budget alert is a
addition to creating a budget alert is a billing export
billing export so you can actually take the billing and
so you can actually take the billing and export it to a number of services
export it to a number of services a little later we'll be talking about
a little later we'll be talking about bigquery which is one of the big data
bigquery which is one of the big data services which is offered by google
services which is offered by google cloud
cloud using billing export you can actually
using billing export you can actually send your billing data to
send your billing data to bigquery data set and using bigquery you
bigquery data set and using bigquery you can run
can run your queries as well we'll talk a little
your queries as well we'll talk a little bit more about billing exports when we
bit more about billing exports when we talk about billing in depth a little
talk about billing in depth a little later in the course
later in the course so the best practice as far as managing
so the best practice as far as managing your cost is concerned
your cost is concerned is to create budget alerts and also to
is to create budget alerts and also to make use of budget exports so that you
make use of budget exports so that you are on top of billing all the time
are on top of billing all the time we already looked at a few ways that you
we already looked at a few ways that you can save money with virtual machines
can save money with virtual machines choose the right machine type and the
choose the right machine type and the right image for your workload
right image for your workload and also be aware of the discounts
and also be aware of the discounts available
available so be aware of the sustained use
so be aware of the sustained use discounts and if you want you can
discounts and if you want you can actually register for a committed use
actually register for a committed use discount
discount and also understand that you can get
and also understand that you can get discounts by using
discounts by using preemptible virtual machine instances
preemptible virtual machine instances instead we talked a little bit more
instead we talked a little bit more about the cost
about the cost involved with your virtual machines
involved with your virtual machines created using your google compute engine
created using your google compute engine i'll see you in the next step welcome
i'll see you in the next step welcome back in this step let's look at another
back in this step let's look at another important feature of a compute engine
important feature of a compute engine which is live migration how do you keep
which is live migration how do you keep your vm instances running
your vm instances running when a host system needs to be updated
when a host system needs to be updated let's say gcp wants to perform a
let's say gcp wants to perform a software or a hardware upgrade
software or a hardware upgrade on your specific virtual machine you
on your specific virtual machine you don't want the application to go down
don't want the application to go down when the software or the hardware
when the software or the hardware upgrade is being
upgrade is being performed to ensure that compute engine
performed to ensure that compute engine provides a feature called
provides a feature called live migration what happens with live
live migration what happens with live migration is that your running
migration is that your running instance is automatically migrated to
instance is automatically migrated to another host in the same zone so if the
another host in the same zone so if the software
software and hardware update is happening on a
and hardware update is happening on a specific host
specific host all the running instances on that
all the running instances on that specific host will be migrated to
specific host will be migrated to another host
another host which is present in the same zone and
which is present in the same zone and this does not change
this does not change any attributes or the properties of the
any attributes or the properties of the vm
vm live migration is also supported for
live migration is also supported for instances even having
instances even having local ssds however it is important to
local ssds however it is important to remember that live migration is not
remember that live migration is not supported for preemptible instances
supported for preemptible instances and instances to which you have added
and instances to which you have added graphic processing units
graphic processing units now how do you configure live migration
now how do you configure live migration how do you configure if you want to use
how do you configure if you want to use live migration or not for your specific
live migration or not for your specific instance
instance the place you would want to configure
the place you would want to configure this is availability policy
this is availability policy this is very very important to remember
this is very very important to remember as far as the examination goes
as far as the examination goes availability policy is where you would
availability policy is where you would configure the live migration
configure the live migration configuration
configuration and as part of availability policy you
and as part of availability policy you can configure two important things
can configure two important things one is on host maintenance
one is on host maintenance what should happen during periodic
what should happen during periodic infrastructure maintenance
infrastructure maintenance the default is migrate which is to
the default is migrate which is to migrate vm instances
migrate vm instances to another host to other how to other
to another host to other how to other hardware
hardware the other thing you can also do is
the other thing you can also do is terminate if you don't want your
terminate if you don't want your instance to be migrated
instance to be migrated then you can choose on-host maintenance
then you can choose on-host maintenance as terminate then
as terminate then the vm instance would be automatically
the vm instance would be automatically stopped at the time of a migration
stopped at the time of a migration the other option you can also configure
the other option you can also configure is automatic restart
is automatic restart in the availability policy you can also
in the availability policy you can also configure if your vm instance has to be
configure if your vm instance has to be automatically restart
automatically restart if they are terminated due to any
if they are terminated due to any non-user initiated reasons
non-user initiated reasons so if you are not terminating the
so if you are not terminating the instance and due to a maintenance event
instance and due to a maintenance event or due to a hardware failure
or due to a hardware failure the instance is terminated in those kind
the instance is terminated in those kind of situations you can also configure
of situations you can also configure that the instance should be
that the instance should be automatically restarted this
automatically restarted this configuration also can be made
configuration also can be made in the availability policy let's see
in the availability policy let's see where the configuration is
where the configuration is in the console right now now this is the
in the console right now now this is the screen from which you can create a vm
screen from which you can create a vm instance
instance you can go in here we already looked at
you can go in here we already looked at availability policy configuration when
availability policy configuration when we were talking about preemptable
we were talking about preemptable instances
instances it's the same place we need to go right
it's the same place we need to go right now as well so i would scroll down and
now as well so i would scroll down and go to management security disks
go to management security disks and if you actually scroll down a little
and if you actually scroll down a little and go towards availability policy this
and go towards availability policy this is where you can see
is where you can see the configuration of on-host maintenance
the configuration of on-host maintenance and automatic restart
and automatic restart this is just below the preemptibility
this is just below the preemptibility configuration so on host maintenance
configuration so on host maintenance when compute engine performs periodic
when compute engine performs periodic infrastructure maintenance
infrastructure maintenance it can migrate your vm instance to other
it can migrate your vm instance to other hardware without
hardware without downtime and you can see that the
downtime and you can see that the default option which is recommended is
default option which is recommended is migrate vm instance
migrate vm instance however if you want you can actually
however if you want you can actually choose to terminate dpm instance as well
choose to terminate dpm instance as well and in addition you can also configure
and in addition you can also configure automatic restart compute engine can
automatic restart compute engine can automatically restart vm instances if
automatically restart vm instances if they are terminated for
they are terminated for non-user initiated reasons maintenance