Cloud Computing #Day 3
Tags: cloud, aws, scalability, loadbalancer
Published: 2022-08-04 06:45:02

We are here on the third day of the exciting cloud voyage where waves of Scaling and Elastic Load Balancing will be clashing so beautifully. So what is scaling or scalability?


## Scalability

<strong>Scalability</strong> involves beginning with only the resources you need and designing your architecture to automatically respond to changing demand by scaling out or in. That is to say it will <strong>monitor</strong> the application and automatically adjust capacity to maintain steady, predictable performance at the lowest possible cost which is infact <strong>Amazon EC2 Auto Scaling</strong>.

![image](https://user-images.githubusercontent.com/88903134/182364597-98d0dd42-abeb-43e7-8c83-fbfae095cc26.png)


## Amazon EC2 Auto Scaling

Amazon EC2 Auto Scaling enables you to <strong>automatically add or remove</strong> Amazon EC2 instances in response to changing application demand. By automatically scaling instances in and out as needed, a greater sense of application availability can be maintained.

This gets even more exciting when we can use two approaches: <strong>dynamic scaling</strong> and <strong>predictive scaling</strong>.

- <strong>Dynamic scaling</strong> responds to changing demand. 
- <strong>Predictive scaling</strong> automatically schedules the right number of Amazon EC2 instances based on predicted demand.

<br/>

> **_Pro Tip:_** Dynamic Scaling and Predictive Scaling can be used together for faster scaling

### Diving Deeper

In the cloud, computing power is a programmatic resource, by adding Amazon EC2 Auto Scaling to an application, new EC2 instances can be added to the application when necessary and terminate them when no longer needed.

#### Working Principle >>


![image](https://user-images.githubusercontent.com/88903134/182369531-74a51659-b6af-4baf-9d9d-d526121c09a8.png)


When preparing to launch an application on Amazon EC2 instance and configuring the size of the Auto Scaling group, you might set the minimum number of Amazon EC2 instances at one. This means that at all times, there must be at least one Amazon EC2 instance running. This is the <strong>minimum capacity</strong>, the number of Amazon EC2 instances that launch immediately after you have created the Auto Scaling group.

The second configuration that can be set is <strong>Desired Capacity</strong>, which is set to minimum capacity by default if it is not explicitly set.

There is also the configuration of setting the maximum capacity to configure the Auto Scaling Group in response to increased demand.


### Chalking out the Benefits

- <strong>Setup scaling quickly</strong> <br/>  

AWS Auto Scaling lets you set target utilization levels for multiple resources in a single, intuitive interface. You can quickly see the average utilization of all of your scalable resources without having to navigate to other consoles.
- <strong>Make smart scaling decisions</strong> <br/>  

AWS Auto Scaling monitors your application and automatically adds or removes capacity from your resource groups in real-time as demands change.
- <strong>Automatically maintain performance</strong> <br/>
  
Using AWS Auto Scaling, you maintain optimal application performance and availability, even when workloads are periodic, unpredictable, or continuously changing.
- <strong>Cost Effective</strong>

AWS Auto Scaling can help you optimize your utilization and cost efficiencies when consuming AWS services so you only pay for the resources you actually need




## Elastic Load Balancing

This is the AWS service that <strong>automatically distributes the incoming application traffic to multiple resources</strong> like Amazon EC2 instances. It monitors the health of its registered targets, and routes traffic only to the healthy targets.  
The load balancer acts as a single point of contact betwwen the incoming traffic and the Auto Scaling Group. Although Elastic Load Balancing and Amazon EC2 Auto Scaling are separate services, they work together to help ensure that applications running in Amazon EC2 can provide high performance and availability.


![image](https://user-images.githubusercontent.com/88903134/182775473-a34280c8-5046-4867-bc10-3c37b6b3371e.png)


The way Elastic Load Balancer toggles the number of instances between High Demand Period and Low Demand Period is essential. Whenever there is a new instance in the network it will only have to send the signal to the load balancer instead of all the sources.

There are three different types of Load balancers:
- Application Load Balancer
- Gateway Load Balancer
- Network Load Balancer


<img src="https://user-images.githubusercontent.com/88903134/182779665-727eebf8-3552-4fff-ab88-e91233ca2c30.png" width=300 height=300 /><img src="https://user-images.githubusercontent.com/88903134/182779137-28cceb38-eb82-4f01-89fe-971d7cd2fa40.png" width=300 height=300 alt=""/><img src="https://user-images.githubusercontent.com/88903134/182779477-6a7b70ff-7e5a-4b88-9363-1a9f60e49a66.png" width=300 height=300/>


### Use Cases

- <strong>Modernize applications with serverless and containers : </strong> Scale modern applications to meet demand without complex configurations or API gateways.
- <strong>Improve hybrid cloud network scalability : </strong> Load balance across AWS and on-premises resources using a single load balancer.
- <strong>Retain your existing network appliances : </strong> Deploy network appliances from your preferred vendor while taking advantage of the scale and flexibility of the cloud.


![image](https://user-images.githubusercontent.com/88903134/182776030-c15299a9-0f14-42e7-9c91-bb120798ad17.png)