[MUSIC]. Welcome to this lesson on scaling. A very important concept within compute. So, what is scaling? There are two kinds of scaling which is possible one is called vertical scaling one is called horizontal scaling. As the name signifies here vertical scaling basically means you're scaling up or scaling down instance shapes. Now, what can you scale? Well, you can scale the course, you can scale memory and some of the other characteristics scale accordingly. The important thing to keep in mind here is when you scale up or scale down, there is a downtime required because likely, we take your machine and when you instantiate a new shape, it actually goes to another host. So there is some kind of downtime required. Keep that in mind when you do vertical scaling. There is another good practice here is you stop your instance before you do any kind of vertical scaling. There's another kind of scaling which is called autoscaling or also referred to as horizontal scaling. Now as you can see in the picture, this basically means that you add more VMs of the same shape or you take away more VMs of the same shape. This enables large scale deployment of VMs. There is scale out as you can see from the picture, you're going from one VM to four VMs or this also scaling, we are going from four VMs back to one VM. So both models support it. Why is this so popular and powerful? The reason it is so powerful is it gives you that scaling capability but it also gives you that high availability. In this case, one virtual machine fails others can still keep working as you can see from the picture. And the thing which makes it really powerful, is you can match traffic demand by adding or removing VMs automatically. So let's say you're operating a web store, suddenly you start getting more traffic, you could easily auto scale and you could add more VMs, the traffic goes down, you could take away those VMs. That's how it works. There is no extra cost for using autoscaling. So how does it work in in practice? There are three steps you have to follow to get autoscaling and it's super easy to do. First thing you do is you have a running instance on which you want to do autoscaling, so you create a template. And a template is called a config in OCI terminology. It's basically things like your operating system image, your metadata, the shape, the size and some other characteristics like storage, networking, etc. So, first you create a stamp. You have a running instance you create a stamp of that running instance. The second step is you take that stamp and then you create this thing called an instance pool. And pool is basically a collection of those instances in advance, you create that and the idea here is, you can manage all these instances as one unit. So you could stop all of them at the same time, you could start them you could terminate them, and to get high availability, you could put them in different availability domains on different data centers. So, that's step number two. And then step number three, is you take your instance pool and then you write these autoscaling rule on that. You start with a desired or initial size. There's a minimum size and then there is a maximum size. And you write a rule as you can see on the screen if CPU or memory goes beyond a particular percentage threshold, add some instances or if it goes below some threshold, remove some instances and autoscaling is constantly monitoring your traffic, it's constantly monitoring your CPU usage and it's looking at whether to add instances or remove instances. So, as you can see in this picture here, we started with an initial size of two. And then if the CPU goes beyond 70%, we have to add two more instances and if it does, you have you end up with four instances. So autoscaling not only helps you meet the traffic demand, but can also give you high availability. So that's a recap. Very powerful feature, autoscaling and then we also looked at another way of scaling vertical scaling. I hope you found this lesson useful. Thanks for watching.