Welcome to the Fourth Tutorial of this AWS Series.
Following are the topics we will cover today:-
- Scalability in EC2
- High Availability in EC2
- Load Balancing
Scalability in EC2
- Scalability of an Application is it's ability to adapt to handle greater loads. Scalability can be Vertical and/or Horizontal.
- Vertical Stability:-
- It refers to increasing the size of a single EC2 instance. E.g. Scaling an Application from T2.micro to T2.large(https://aws.amazon.com/ec2/instance-types/).
- Vertical Scalability is mostly used for Non-Distributed Systems like Relational Databases. EC2 has features like RDS, ElastiCache that can scale vertically.
- There is a limit to how much we can scale Vertically.
- Horizontal Scalability:-
- It refers to increasing the Number of EC2 Instances/Systems in your Application.
- Horizontal Scaling is mostly used for Distributed Systems and is very common in Modern/Web Applications.
- It's pretty easy to do horizontal scaling using AWS EC2 services.
High Availability in EC2
- High availability requires running your Application in at least two Data Centers which will be the availability zones. It's aim is to survive even in case of single Data Center loss.
- Horizontal Scaling can be thought of as Dynamic High Availability. RDS or Load Balancer in Multi-Availability-Zone can be considered as static High Availability.
- Load Balancers are servers that forward internet traffic to multiple EC2 Instances in way so as to balance out the load on individual EC2 instance.
- A Load Balancer's job is to spread load across multiple EC2 Instances, expose a singl epoint of access to your application, enforce stickiness with cookies, separate public traffic from private traffic etc.
- You should use EC2's load balancer (ELB) which is managed by AWS. Advantage with ELB is that AWS manages it, takes care of the upgrades, maintenance etc, also there are only few knobs to configure so it's hassle free.
- AWS has 3 kinds of managed Load Balancers:-
- Classic Load Balancer (v1) - HTTP, HTTPS, TCP
- Application Load Balancer (v2) - HTTP, HTTPS, WebSocket
- Network Load Balancer (v2 new generation) - TCP, TLS (secure TCP) & UDP
- You can also use your own private ELB.