Section8: High Availability and scaling Flashcards
Why use Elastic Load Balancer?
- Its a managed load balancer, AWS takes care of it.
Name 4 types of load balancer on AWS
1) Classic Load Balancer(v1 - old generation) 2009
- Supports Http(layer7),Https TCP(layer4),SSL
2) Application Load Balancer (v2 - new generation,Layer7 load balancer) 2016
- Can do routing
- Are great for micro services and container-based applications
- Supports HTTP, HTTPS, WebSocket
3) Network Load Balancer(v2 - new generation,layer 4) 2017
- Support TCP,TLS,UDP
4) Gateway Load Balancer 2020
- Operates at layer 3(Network layer)
What is SNI?
- Stands for Server Name Indication.
- Solves the problem of loading multiple SSL certificates onto one web server.
- Its a “newer” protocol and requires the client to indicate the hostname of the target server in the initial SSL handshake.
- The server then find the correct certificate or return the default one.
- Note:
- Only works for ALB & NLB,CloudFront
- Does not work for CLB.
What is Connection Draining?
- In CLB it is called Connection Draining but in ALB & NLB it is called Deregistration Delay.
- Time to complete “in-flight requests” while the instance is de-registering or unhealthy.
- Stops sending new request to the EC2 instance which is de-registering.
- Time is set between 1 to 3600 seconds(default:300 seconds)
Things to remember about ASG(Auto scaling groups)?
- Scaling policies can be on CPU, Netowrk or custom metrics.
- ASG use Launch configurations or Launch Templates
- To update an ASG, you must provide a new launch configuration/launch template.
- IAM roles attached to an ASG will get assigned to EC2 instances.
- ASG are free, you only pay for the resources used.
- Having instances under the ASG means that if they get terminated for whatever reason, the ASG will automatically create new ones as a replacement. Extras safety.
- ASG can terminate instances marked as unhealthy by an LG
Auto Scaling Groups - Dynamic scaling Policies
1) Target Tracking Scaling
- Most simple and easy to setup
- Example: I want the average ASG CPU to stay at 40%
2) Simple/Step Scaling
- When a CloudWatch alarm is triggered(example CPU > 70%) then add 2 units
- When a CloudWatch alarm triggered(example CPU < 30%) then remove 1 unit
3) Scheduled Actions
- Example: increase the min capacity to 10 at 5pm on Fridays
4) Predicting scaling
- Continuously forecast making use of machine learning
Good metrics to scale on for Auto Scaling Group?
- CPUUtilization
- RequestCounterPerTarget
- Average Network In/ Out
- Any custom metric