Products and Services
The course is part of these learning pathsSee 8 more
There are a lot of different options, across a variety of cloud platforms that are well suited for running specific workloads, such as web applications. Things such as Google App Engine, AWS Elastic Beanstalk, Azure App Services: Web Apps, among others.
However, there are still plenty of times where we need to set up our own infrastructure. And so cloud vendors offer IaaS (infrastructure as a service) options. Google provides us with Compute Engine which allows us to create virtual machines, custom images, snapshots, networks, auto-scalers and load balancers.
If we're going to create and implement an application on the Google Cloud Platform system operations, then understanding these services are going to help us to create highly available, highly scalable applications.
All the major cloud providers offer the ability to set up virtual machines, networks, auto-scalers, and load balancers. Where the Google Cloud is different is in the speed of creating and starting up virtual machine instances. As well as the massively scalable software-based, global load balancer; which doesn't require pre-warming. Google also offers per-minute billing for VM instances, after the first 10 minutes.
So Google has a lot to offer. And if you're looking to learn more about the Google Cloud systems operations, then this may be the course for you.
What exactly will we cover in this course?
Course Objectives: Google Cloud Platform system operations
By the end of this course, you'll know:
How to use Compute Engine to create virtual machines
How to create disk snapshots
How to create images
How to create instance templates and groups
How to create networks
How to use the auto-scaler and load balancer
This is an intermediate level course because it assumes:
You have at least a basic understanding of the cloud
You’re at least familiar with general IT concepts
What You'll Learn
Summary A review of the course
|Lecture||What you'll learn|
|Intro||What will be covered in this course|
|Getting Started||An introduction to the Google Cloud Platform|
|Networking||How to create and secure Cloud Networks|
|Disks and Images||An overview of disk types and images|
|Authorization and IAM||How to authenticate and authorise users|
|Disk Snapshots||How to use snapshots for point-in-time backups|
|Cloud Storage Overview||A refresher on Cloud Storage|
|Instance Groups||How to manage instances with managed and unmanaged groups|
|Cloud SQL Overview||A quick primer on how to use Cloud SQL|
|Startup and Shutdown Scripts||Using startup scripts to provision machines at boot time|
|Autoscaling||How to automatically add and remove instances|
|Load Balancing||How to balance traffic across instances|
|Putting It All Together||A demo of how to use some of the services we've learned about|
Welcome back. In this lesson we'll be covering instance groups. We'll do an overview, and then we'll talk about the use cases, and then we'll wrap up with some examples.
Let's start with, what are instance groups? As the name suggests, instance groups are about creating a grouping of instances. And once we have a group, we can monitor all of the servers in that group, or we could reboot them all at the same time, and we can do other similar tasks like this. And we can do that with two different types of groups. We have managed and unmanaged groups.
Unmanaged groups are pretty simple. The concept is that you can take instances that already exist and add them together into an unmanaged group and then you can do some simple admin tasks. Those are things such as rebooting, you can monitor, et cetera. And that's about it. They're designed to make it easier to manage existing infrastructures.
Managed groups, on the other hand, are the Google recommended form of instance groups. And the reason is that they have a lot more functionality than the simple administration that they share with unmanaged groups. With managed groups, we don't need to manually add instances, hence the managed part of the name.
Let's cover some of the features that managed groups offer and then we'll dive into how they actually work. Managed groups will ensure that the instances in that group are all running. And we can resize the group as needed, which means if we want to add 10 new instances, we can do that rather easily by increasing the minimum number of instances and they're going to be automatically added. Managed groups also make autoscaling possible because we can use metrics to determine if we need to add or remove instances. By the way, we'll cover autoscaling in a later lesson.
Now, you may be wondering how managed groups are able to automatically add instances. How do they know which instances to add? Managed groups require that you specify an instance template which allows you to define the machine type, image, zone, and other instance properties for the instances that will be created. An instance template is basically all of the info you'd supply if you were to create an instance, however it doesn't actually create it at that time, it just saves those settings for you. And that includes things such as startup scripts.
Let's check out how to create an instance template and a managed group. We start out on the instance template page, and click create. And this page will look familiar. It's the same form we use when creating an instance. We'll give our template a name. Since this will be a template for a web application, I'm going to call it webapp-template. And now, let's change the machine type. We'll use a small for this demo, since we really aren't expecting any traffic. And let's change the boot disk to use Ubuntu 16.04 LTS. That's just the preference I have. Notice there are a lot of other options here.
Under identity and access, I'm going to change the scope to full scope. I don't recommend this for production systems, this could end up being a security nightmare if just one server is compromised, because the attacker could use all of the APIs that Google Cloud has to offer with no restrictions. And you can imagine the implication of that. I'm using it here to make it easier to interact with some of the different APIs from my startup script, but again this is just for a demo.
Now, I'm going to select allow HTTP and HTTPS and that will automatically apply some tags to allow the traffic to flow through the firewall. And I want to actually provision the instance on startup, so I'm going to add a startup script. We'll be covering startup scripts in a later lesson, so I'm not going to go in depth now. So we'll just click on the management link here and we'll paste in our startup script. There we go.
Now let's take a moment. I just want to briefly show you what's going on with this startup script in the code editor. This is a pretty vanilla Bash script, and what it's doing is, it's going to fetch the project ID from the metadata server and then it grabs the latest code from the web app Cloud repo, and inside that repo is a shell script to build the application. In this example, I'm building the code out on the web server directly. This isn't something you'd do in production. You'd use a build server and you'd run your code through the complete continuous delivery pipeline. However, again this is just an example so I'm just going to build it on the server.
So if you look at that script, we see that it installed some dependencies; it installed some logging code, and then it's going to deploy our actual .net application behind engine X.
Okay, let's go back to the Google Cloud console, and since everything looks good with the rest of the default, we're going to create this. Now, to use this, we need to create a group. So we'll click on the instance groups and fill out the form. Like everything else, it's going to need a name, and we're going to skip the optional description, however, you should use this in your environments to clearly define what the group is for. We'll leave it as a single zone, however if you need high availability, you could use multi-zone. I'll use east1-d just to stay consistent with the rest of the services that I have running.
And then, in this section here, for the create method, this is where we'd select managed or unmanaged. Now notice that isn't what it's called on the form. The term Google uses here are use instance template or select existing. So, we know that managed groups use instance templates so we're going to use the "use instance template" option. And it wants us to select our template, we only have the one, so it's a really easy decision here. And we can also enable autoscaling. For this demo, I'm not going to show how to use that, that's something we're going to cover in a later course, so I'll save that.
Now let's create this group. It'll take a few minutes, and let's just jump to the end. And there we go, it's complete and we can click into it and we can see that it has one running instance. And if we browse to the IP address for that instance, we can see that our web application is actually running.
Okay, so creating these is fairly easy, and we'll expand on managed groups in a later lesson when we cover autoscaling which means that's going to wrap up this lesson.
In our next lesson, we'll look at Cloud SQL. So, if you're ready to keep learning, then let's get started with the next lesson.
Ben Lambert is a software engineer and was previously the lead author for DevOps and Microsoft Azure training content at Cloud Academy. His courses and learning paths covered Cloud Ecosystem technologies such as DC/OS, configuration management tools, and containers. As a software engineer, Ben’s experience includes building highly available web and mobile apps. When he’s not building software, he’s hiking, camping, or creating video games.