Associate Cloud Engineer Certification | Google Cloud (GCP) | First 25 Steps

141.46k views17071 WordsCopy TextShare
in28minutes - Get Cloud Certified
Google Cloud Associate Cloud Engineer Certification - Getting Started Full Course - https://www.ude...
Video Transcript:
cloud is growing 50 percent every year and the enterprise world is going multi-cloud more than ever before it is important to understand and learn multiple clouds i am ranga 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 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 are you ready to start your google cloud journey and become a good cloud certified associate cloud engineer what are you waiting for join me on this exciting journey right now i'll see you in the course welcome back welcome to this course to help you become a google certified associate cloud engineer i am ranga 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 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 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 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 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 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 from my experience number one active learning think and make notes whenever you see something interesting write it down number two review the 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 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 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 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 while you learn i'm really excited to help you get gcp certified
and i'll see you in the next step 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 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 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 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 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 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 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 gcp provides 200 plus services and over the last few years gcp has proved to be reliable secure and highly performant it is important to remember that this is the same infrastructure that powers eight services with over 1 billion users some of the most popular google services like gmail google search and youtube make use of the same 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 cloud services there is no single path to learn these services independently 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 and i'll see you in the next step 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 and once you are here you can go and click get started for free on the next 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 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 you in the next step in this tip let's understand why we need 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 your application goes down so you have low availability now how can we improve this 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 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 even if one of the data center crashes we can serve it from the other data 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 now we understood the reason why we need 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 problem in the next step 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 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 region to them and therefore they get low latency global footprint a startup in india might be able to easily deploy 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 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 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 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 the next step 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 you'd need servers and when you want to 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 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 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 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 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 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 virtual machines in gcp and it provides you with a number of features let's start playing with google compute engine starting the next step welcome back let's start playing with google compute engine in this specific 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 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 and now you should not see that message anymore when you log into google cloud console you should see the dashboard 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 is creating a compute engine so i can type in compute engine in here so over here you can go to compute 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 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 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 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 high performance machine types for compute intensive applications there are also memory optimized so these 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 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 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 if you scroll a little down you'll also see something called a firewall 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 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 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 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 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 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 once you choose the machine family you need to choose the machine type how much exact amount of cpu memory or disk do you want for each of the machine 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 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 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 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 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 the external ip is the one which we can make use of to talk to this virtual machine from the internet you can also ssh into the virtual machine by using this button which is present
in 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 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 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 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 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 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 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 installed by default on debian and i can do apt update i can do a app update to pull in all the latest changes so let's do a apt space update 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 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 would be installed in a little while 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 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 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 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 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 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 and let's press enter now let's go in here and refresh the 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 so what i would want to do is i would want to add this information to
my index.html so let's start with actually printing 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 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 so let's paste that in and let's see if we are able to see it in here cool you can see hello world from my first vm 10.128.0.2 in this step we
installed 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 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 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 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 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 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 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 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 the earlier external ip is no longer 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 i can go in and use the external ip and you
can see that it's saying hello world from my first vm 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 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 and over here now i can go and say my first 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 i would go ahead and say reserve now this would actually create a static 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 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 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 i'll say 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 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 static ip addresses in the next step 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 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 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 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 i'll see you in the next step 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
when a vm instance is launched is called bootstrapping you know you are launching up a virtual machine you want to be sure that it is 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 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 we are heading to 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 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 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 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 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 remembering about startup script is very very important 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 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 of that specific family is used let's
now try and create a instance template and create a couple of vm instances how can i create an instance template i think that's very easy right i can go to instance templates and create it now before that what i would do is i would go into the instance which is already running and copy the startup script for it so if you scroll down and go to the metadata part of it and go to custom metadata this is where you can see the startup script what i would do is i would want to use this startup
script so i'll copy this you can also copy it and paste it to a text file so that we can reuse it multiple times i would go to nav instance templates and we don't create an instance template so create new instance template i would call this my instance template with startup script you can see that i don't really need to specify a region or a zone when i'm creating an instance template because instance template can be used to create resources in different regions and different zones that's the reason why we don't need to configure a
region or a zone i'll choose the default machine type which is recommended i'll choose the default boot disk which is recommended and i'll say i love http traffic and i'll go into management security disks and networking this would be the same as what we would have when we configure a virtual machine and over here i would go and configure a startup script so this is the same thing that we configured earlier and let's go ahead and say create there is no cost associated with creating an instance template however when we create instances using the instance
template then we would need to pay for it now let's try and create an instance with this specific instance template all 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 earlier are pre-populated you can choose the region and zone however you'd see that all the things like machine configuration the boot disk these are pre-populated with the values we chose when we were creating the template you can see that the firewall is automatically configured to allow http traffic
and if you click on management you'd see that the startup script is already populated in here you can customize this further if you don't but ideally what you need to do is to use a instance template and then directly go ahead and create a instance you can see that now a new instance is being created using the instance template now you can use this instance template to create as many instances that you'd want let's go back to vm instances i don't really need the my vm with startup script anymore so let's go ahead and delete
that so i've selected this and let's go ahead and delete it so this would delete the myvm with startup script the only vm that would be running right now is the one which was created using my instance template with startup script you can see that the name of that specific instance is the name of the template appended with a numeral so it's hyphen 1 in here and you can see that this is assigned a external ip let's click that and you can see that hello world is coming from my instance template with startup script 1
and the internal ip10 12804 let's make sure that this is the right instance yep in the last few steps we saw how we can simplify the creation of vm instances and also set up some software on it we started with the manual approach where we created a vm instance we ssh into it and then set up the software using a few commands after that we made use of a startup script enough we have a template and now with the template it's very easy you can use the template and launch new instances at will i'm sure
you're 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 of virtual machine and setting up software on it using a instance template however there is one more problem with the approach that we took installing os patches and software at the launch of vm instances increases boot up time so whenever we create a instance if you are installing a lot of software or a lot of os patches then it takes a lot of time to launch that vm instance how can
we avoid that one of the approaches that we can take is to create a custom image with os patches and the software pre-installed so we can create an instance we can create a custom image out of it and we can create further instances using that custom image in google cloud you can actually create a custom image in a number of ways a little later in the course we look at what is a persistent disk and what is a snapshot whenever we attach a hard disk with the instance what we are attaching is a persistent disk
and a snapshot is nothing but a copy of a persistent disk you can create a custom image from either a vm instance a persistent disk a snapshot another image or a little later we'll also talk about cloud storage cloud storage is an object storage which is provided by google cloud you can also store a file in cloud storage and create an image from it we'll discuss this a little bit more when we talk about persistent disk and snapshots for enough what we would do is we would actually create a image from an existing compute engine
instance once you create a custom image you can actually share it across projects google cloud also provides the feature to deprecate old images so whenever you create an image and let's say over a period of time it has become an old image and you don't want anybody to use it then you can mark it as deprecated along with marking it as dedicated you can also say this is the new recommended image so the recommendation is whenever you are creating a new custom image and the old one is outdated go ahead and mark the old one
as deprecated one of the advantages of actually creating a custom image is to ensure that all your corporate security standards are incorporated into the image what you can do is you can actually create a vm instance which adheres to all your corporate security standards and from that you can actually create a image this process of doing this is called hardening a image creating an image which adheres to all your security standards once you have a hard end image you can use that to create secure vm instances the next recommendation is to prefer using custom image
to start up scripts startup scripts include the boot up time and therefore it's recommended to actually create a custom image let's now see how to create a custom image and let's see how you can use that in an instance template i have one vm instance which is running right now that's vm my instance template with startup script one if i minimize this and actually expand storage this is where you can see disks so this is the this are nothing but the hard disks which are associated with your virtual machine whenever you create a virtual machine
the operating system of the virtual machine runs on a hard disk which is attached with that specific virtual machine and that's what you are seeing in here you can see this specific disk which is attached with our virtual machine you can see that it also has the same name my instance template with startup script 1 and you can see that by default it has a size of about 10 gb now we want to create a image we want to create a copy of this specific disk how can we create an image from the specific disk
the way you can do that is by going to actions and clicking create image so we go ahead and say create image you can see that the source of this specific image is a disk the name of the disk is present in here and if you scroll down you can also choose the location do you want this image to be stored multi-regionally or regionally if you expect this image to be used in other regions then you can go with multi-regional if you are expecting this image to be used only in a specific region then you
can go for regional what i would do is i would leave it at the default multi-regional i'll take the default for rest of the things including encryption and i would go ahead and say create when i go ahead and say create there is an error which pops up the reason for the error is because the disk is now attached to a running instance the recommendation is that you should never create a image from a disk which is connected to a running instance you should always stop the instance and then create a image from that specific
disk so what we would do is actually go in and go to the virtual machine instances open it in new tab and you can go in here and select this and i would want to actually stop this so we are stopping the virtual machine instance let's wait for it to be stopped you can check this checkbox and take a image without stopping the instance however that is not really recommended and that's the reason why we have started to stop the instance and you can see that the instance is not stopped and i would go ahead
and now say take a copy let's say create oops it's not discovering the fact that 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 i'll call this my custom image i'll choose the same options that we chose earlier and say create now because the instance is stopped it would go ahead and create that specific image the creation of the image would take a little while so it's going to the list of images you can see all the public images
which are present in here the one which we have created just now is a private image if you wait for a few minutes and do a refresh then you'd see our specific image come up in here you can see that my custom image is present in here and within a couple of minutes you would see that the status of it is ready to use now i can go ahead and use this to create a vm instance so what i would need to do now is go ahead and say create instance or the other option is
actually i can create a instance template based on this specific image as well so i can go into virtual machines and let's go to instance templates and what we want to do is to actually use this instance template and make a copy so i'll take the copy of the existing instance template so i'll say copy so it would copy everything from the earlier instance template i've now renamed this to my instance template with image or i would say with custom image and i would go in over here i take the same machine family as earlier
the boot disk i want to change this so instead of debian i want to use my custom image so i would go in here and click custom images and select the image so if you wait for a little while my custom image should appear in here and you can say select and once you select that you can go into management security disks networking and stuff and over here in the startup script you don't really need to do the install all that you need to do is to create the html file because you would want to
put host specific information in there and once you create the html file you also want to start up the server so you want to start up apache the way we can do that is by just saying service apache to start so we are populating the html file and then we are starting up the web server we don't really need to install apache anymore because it's already part of the image so this would create a instance template this is using the custom image that we created just now and using this instance template you can actually launch
as many instances as you would want and these instances would be created with the custom image that we created i can go ahead and create a instance using this particular virtual machines also create virtual machine i'll take all the defaults which are suggested and say create and while the new instance is being created what i would do is i would delete the old instance which was created with this startup script so i'll go ahead and delete that i don't really need that anymore my instance template with custom image one is now ready give it a
couple of minutes and then go ahead and click external ip and then you should see my instance template with custom image 1 10.128.0.5 and you can see that this is the internal ip of this specific one so you can see that over the last few steps we understood a lot about virtual machines we were playing with the life cycle of the virtual machines which to stop start delete them we also played with instance templates and we also played with images welcome back in this step let's try and understand how to debug problems if you have
problems installing the apache web server or running this specific url now let's say you went through all these steps but you are not able to see this url launch up you have used the external ip which is present for the instance and let's say you are running it and you are still having a problem what are the things that you would want to check number one make sure that you are using the external ip of the running instance if i refresh the vm page this is where i can see the external ip make sure that
you click that and open it in a new window so that's number one so make sure that you're using the right url if you are sure that you are using the right url then what you can do is go and ssh into it make sure that you are able to ssh into it if you are able to ssh into it then make sure that your apache web server is properly installed i can do an ls and look at slash wire slash www slash html so ls slash bar slash www.html and what do i see i
see a index.html file which is present in here now i would want to see what is the content which is preset in this specific file so i'll say cat slashware slash www slash html slash index dot html what would it show it shows the content of this specific file you can see that the content of this specific file is what i am seeing on the web browser so make sure that this file is present and it has the right content that you would want to see once you make sure that the file is there and
the content is fine as well what you can also do is to make sure that the apache service is started up fine so you can type in service apache to space start before we'd be able to do a service apache to start i would actually need to do a sudo su 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 and after this you can actually go and check if your url is working if your url is still
not working there is one more thing that you can check which is to click this vm instance so open the vm instance app and if you scroll further down you should see firewalls and in the firewalls you should see i love http traffic checked if you don't see this checked then you can actually edit this and check that so if you say edit you can go in here check this check box and make sure that you save it once you save the vm instance you can go and click the external ip of it and you
should see the page come up in this video we looked at how you can debug problems with installing the apache web server on a vm instance 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 offered by google cloud platform web console this is also called just the console whenever people say console then they are referring to this specific thing and over here the most important thing is the pencil which is present in here you can
go in here and access the different services which are present in here the other way you can access the services is the way we have been doing until now so let's say i would want to access kubernetes engine i can type in kubernetes in here or i can go to the pencil and i'll i can navigate to kubernetes it would be under compute and then i can go in and access that specific service the interesting thing about using the pencil is that whenever you want to actually make mark anything as favorite you can actually pin
it maybe i'll be playing with compute engine a lot then i can go ahead and pin this so then what would happen is compute engine would come up in here so when i click my navigation menu i can see compute engine right at the top so if you're playing with any service a lot then you can make use of this feature and you can directly access your vm instances now let's see what's under home under home you can see dashboard dashboard is the screen which we saw when we first came to google cloud it contains
the project information it contains different apis that we are making use of you can see that we are making use of a lot of api calls whenever we create resources a lot of apis are called and that's the resources that we are seeing in here over here you can also see this current status of the google cloud platform you can see that all the services are normal right now you can also see the billing information and if you scroll down you'll also see a lot of information around monitoring and error reporting another thing you'd see
in here is activity if you go to activity you'd see a lot of information about what you have been doing until now so over here you can see that i have been doing a lot of activities creating and deleting vms and playing around with them so you can see that and if you want you can go ahead and filter among the activities so you can go to the activity type and select what kind of activities you are interested in configuration data access development or monitoring you can also choose which type of resources you would want
to focus on you can see that almost 75 different types of resources are selected in here by default you can choose whichever one you'd want to look at the last tab which is present in here is recommendations google cloud would automatically analyze your cloud usage and if they have any recommendations they would show them in here as of now as you can see there are no recommendations for me other than that if you click the pencil and go on the left hand side you can see all the services which are present in here right so
you can see compute services you can see compute services on the left hand side a lot of them in here you can also see different you can see storage services database services you can see the networking services which are present in here and there are also other services to support your operations and there are a few tools and you'll also see services to help you with big data and artificial intelligence as you can see in here this is the project which we are working in my first project if you want you can actually create a
new project and create resources under that specific project as well for enough let's keep using my first project which is the default project which was created for us other than that in the top menu you can also see your free trial status if you click this you can see how much of your free trial credit is remaining and how many days are remaining in your free trial you can get help by clicking this question mark in here and if there are any notifications you can see them in here there are notifications created whenever you create
or delete or update a instance there will be notifications created for that and you can click this three dots in here to look at a few more settings if you go in here and go over to project settings you'll be able to see the settings for our current project the idea behind this step was to quickly navigate around and play around with the cloud console so that you are familiar with it when you keep using it during this specific course what i'll do now is i'll go ahead and click dismiss over here and i'll see
you in the next step welcome back until now we have been playing with virtual machines starting this step let's look at a few important things that you need to understand about keeping your costs low whenever you're making use of the cloud you'd want to keep your costs as low as possible what are the things that you can do to keep the to keep the cost of your virtual machines low the first thing that we would be talking about is sustained use discounts what is a sustained use discount it's an automatic discount which is applied for
running vm instances for significant portion of the billing month for example if you are using n1 or n2 machine types for more than 25 percent of the time period of the month and then you get about 20 to 50 discount on every incremental minute so beyond 25 percent whatever time period you are running for you would get a discount on it and the discount increases with the usage if you are using the vm for eighty percent of the month the amount of discount you would get would be higher than the amount you would get if
you are running it for forty percent and the great thing about the sustained use discounts is that you don't really need to do anything there is nothing you need to do specifically for this when you are creating or running your virtual machines this is automatically applied by the platform itself however there are a few important restrictions that you need to remember a little later in the course we'll be also talking about google kubernetes engine which is a managed kubernetes service which is provided by google cloud platform whenever you are creating instances using the google compute
engine that's basically what we are using in the course until now or whenever you create instances using google kubernetes engine the sustained use discounts are automatically applied remember that this does not apply on certain machine types for example e2 and a2 the sustained use discounts do not apply for them and also remember that if you are using app engine flexible or data flow to create the vms sustained use discounts do not apply we will talk about app engine and data flow as we go further in this course the important thing to remember about sustained use
discounts is the fact that these are automatically applied when you use instances which are created by google kubernetes engine and compute engine for a significant part of a specific month also remember that there are a few restrictions i'm sure you're having an 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 applied on your virtual machines however this type of discounts need a commitment from you and that's the reason why these are called committed use discounts using committed use discounts is recommended
for workloads with predictable resource needs you can say i would need a virtual machine of this type for one year or three years and depending on the machine type and the gpus you are asking for you can get up to 70 discount the discount that you would get with committed use discount is higher than the discount that you would get with sustained use discounts so if you are sure that you need a specific virtual machine for one year or three years then it makes sense to go ahead and register for a committed use discount because
this gives you more discount than depending on a sustained use discount again the committed use discount is applicable for instances which are created by google kubernetes engine and compute engine and and the same restriction that we talked about when we talked about sustained use discounts applies for committed use discounts as well this does not apply for vms created by app engine flexible and data flow now how can you ask for a committed use discount let's go back to our virtual machines and in the menu for virtual machines the last option you would see is committed
use discounts this is where you can actually go in and ask for a committed use discount this is where you can actually go in and purchase a commitment so i can go ahead and say purchase a commitment and i can say i want to purchase a specific commitment as you can see in here you can actually purchase a hardware or a software commitment what we are interested in is a virtual machine commitment which is a hardware commitment so you can give it a name you can choose which region you would want to have the commitment
in and you can choose the specific family you'd want to commit on and then you can specify how much duration you want to commit on you can also specify a little bit about the configuration of the machine you want do you want course do you want memory do you want gpus do you want local ssds and then you can go ahead and click purchase i'm not going to click purchase in here because i don't really want to commit on it what i would do is i'll go ahead and say cancel once you register a commitment
if you create any new instances of that type the discount is automatically applied in this step we talked about committed use discounts these are recommended for workloads with predictable resource needs you know ahead of time that i would want to run a web application for a long time in those kind of situations you can get the best discounts by going 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 preemptible virtual machines preemptive virtual machines are short-lived cheaper compute instances if you
are aware of aws then pmt build vms are very very similar to spot instances the preemptible instances can be stopped by gcp anytime within 24 hours the maximum time that you can run a preemptable instance typically is 24 hours and you need to remember that gcp can terminate this instance any time within the 24 hours period as well just before gcp terminates your instance you will get a 30 second warning you can use this time period to save anything you might want to save now when do you go for a preemptable vms you'd use a
preemptable vm if your applications are fall tolerant you can stop and start them at any point in time and you are very very sensitive you want to run the workload with minimum cost and your workload is not immediate if your users are accessing a specific application then your workload is immediate you would want to run that immediately however if you have batch programs which you can run let's say within the next 15 days or within the next month those are good workloads where you can go for preemptable vms so a good example is non-immediate batch
processing jobs now let's look at a few restrictions preemptable vms might not always be available number two there is no sla that is guaranteed by google cloud platform and your preemptable vms cannot be migrated to a regular vm you cannot convert a preemptable vm into a regular vm and number three is you cannot automatically restart them if they are stopped due to any reason you cannot actually restart them again and the last but very important one as far as this course is concerned is free tire credits are not applicable for launching preemptable vms so i
would recommend you to not launch preemptable vms at all now let's try and see how you can actually launch a preemptible vm we're not going to launch it we're just going to see where you can actually launch it so i'm going to vm instances and you can go and say create and this is the typical configuration we do now where can i do preemptable instance the place where you can configure that is in management security disk networking and sole tenancy if you go further down if you go to the availability policy that is where you
can actually configure the preemptibility a preemptable vm costs much less but lasts only 24 hours it can be terminated sooner due to system demands and this is where you can actually set it to on if you set preemptibility to on and launch an instance then it becomes a preemptable instance in this step we looked at preemptable vms these are short-lived very very cheap compute instances which you can use to run non-immediate fault tolerant workloads if you have a non-immediate batch program that you would want to run at a very very low cost then you can
opt for a preemptible vm i'm sure you're having a wonderful time and i'll see you in the next step welcome back in the last few steps we were talking about a few discounts that are applicable for your google compute engine in this step let's look at a few more important things around building of your compute engine it is very important to remember that you are built for compute engine by the second however this is only after a minimum of one minute so if you start a new vm instance you will pay for a minimum of
one minute and thereafter you'll be billed by the second whenever you stop a compute engine instance you are not built for compute however remember that if you have any storage that is attached with the compute instance you'd still be billed for it the first recommendation when it comes to reducing your billing is to always create budget alerts how can you create budget alerts if you go over to the navigation menu on the left hand side you should see something called billing and in billing you should see budgets and alerts if you click that you'd be
landing on this specific screen where you can actually create a budget award surprises on your bill by creating budgets to monitor all your google cloud charges at one place after you set a budget you can create budget alerts to email billing admins and users when charges exceed a certain amount so go ahead and create a budget let's create a budget right now create a budget and i would call this budget as my first budget and i'll choose the defaults which are suggested for me so i'll choose all projects all services and i would say next
and over here i can specify a target amount i'll say the target amount for me is let's keep it as low as possible so 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 alert threshold rules so you can configure alerts at different thresholds you can see that the defaults which are suggested are get an alert when 50 of the budget is utilized which is 5 rupees get an alert when ninety percent of the budget is utilized and also
when hundred percent of the budget is utilized you can further customize these thresholds if you want and if you scroll down you can configure the notifications as well so make sure that you check this up so email alerts to billing admins and users this would ensure that you get an email when the cost exceeds your limits and at the end of that you can go ahead and click finish now the other thing that you can do in addition to creating a budget alert is a billing export so you can actually take the billing and export
it to a number of services a little later we'll be talking about bigquery which is one of the big data services which is offered by google cloud using billing export you can actually send your billing data to bigquery data set and using bigquery you can run your queries as well we'll talk a little bit more about billing exports when we talk about billing in depth a little later in the course so the best practice as far as managing your cost is concerned is to create budget alerts and also to make use of budget exports so
that you are on top of billing all the time we already looked at a few ways that you can save money with virtual machines choose the right machine type and the right image for your workload and also be aware of the discounts available so be aware of the sustained use discounts and if you want you can actually register for a committed use discount and also understand that you can get discounts by using preemptible virtual machine instances instead we talked a little bit more about the cost involved with your virtual machines created using your google compute
engine i'll see you in the next step welcome back in this step let's look at another important feature of a compute engine which is live migration how do you keep your vm instances running when a host system needs to be updated let's say gcp wants to perform a software or a hardware upgrade on your specific virtual machine you don't want the application to go down when the software or the hardware upgrade is being performed to ensure that compute engine provides a feature called live migration what happens with live migration is that your running instance is
automatically migrated to another host in the same zone so if the software and hardware update is happening on a specific host all the running instances on that specific host will be migrated to another host which is present in the same zone and this does not change any attributes or the properties of the vm live migration is also supported for instances even having local ssds however it is important to remember that live migration is not supported for preemptible instances and instances to which you have added graphic processing units now how do you configure live migration how
do you configure if you want to use live migration or not for your specific instance the place you would want to configure this is availability policy this is very very important to remember as far as the examination goes availability policy is where you would configure the live migration configuration and as part of availability policy you can configure two important things one is on host maintenance what should happen during periodic infrastructure maintenance the default is migrate which is to migrate vm instances to another host to other how to other hardware the other thing you can also
do is terminate if you don't want your instance to be migrated then you can choose on-host maintenance as terminate then the vm instance would be automatically stopped at the time of a migration the other option you can also configure is automatic restart in the availability policy you can also configure if your vm instance has to be automatically restart if they are terminated due to any non-user initiated reasons so if you are not terminating the instance and due to a maintenance event or due to a hardware failure the instance is terminated in those kind of situations
you can also configure that the instance should be automatically restarted this configuration also can be made in the availability policy let's see where the configuration is in the console right now now this is the screen from which you can create a vm instance you can go in here we already looked at availability policy configuration when we were talking about preemptable instances it's the same place we need to go right now as well so i would scroll down and go to management security disks and if you actually scroll down a little and go towards availability policy
this is where you can see the configuration of on-host maintenance and automatic restart this is just below the preemptibility configuration so on host maintenance when compute engine performs periodic infrastructure maintenance it can migrate your vm instance to other hardware without downtime and you can see that the default option which is recommended is migrate vm instance however if you want you can actually choose to terminate dpm instance as well and in addition you can also configure automatic restart compute engine can automatically restart vm instances if they are terminated for non-user initiated reasons maintenance event hardware failure
software failure or other such reasons and you can leave the automatic restart at on which is the recommended option and the default option as well in this step we looked at a important option to have high availability for your virtual machines you can set on host maintenance to migrate and you can enable automatic restart i'm sure having a wonderful time and i'll see you in the next step
Copyright © 2024. Made with ♥ in London by YTScribe.com