Elastic Load Balancing
With the help of Elastic load balancing, you can distribute traffic across group of EC2 instance in one or more Availability Zones. Elastic Load balancing support Routing, and load balancing of HTTP, HTTPS, TCP and SSL traffic to EC2 instances. It provides the single CNAME entry for DNS configuration and support both Internet facing and internal facing load balancers.
Types of load balancers:
There are following types of load balancers:
- Internet-facing Load Balancers: It takes requests from client from internet and distribute them to Amazon EC2 instance that are registered with load balancer.
- Internal Load balancers: Internal Load balancers are used to distribute the traffic between Amazon EC2 instances in VPC with private subnets.
- HTTPS Load balancers: In this traffic is encrypted between your load balancers and clients that initiates HTTPS sessions. In order to use SSL, a SSL certificate must be installed on the load balancer where connection is terminated and traffic is decrypted and is then sent to Amazon EC2 instance.
Listeners: A listener must be configured which checks for connection requests. Every Listener is configured with a protocol and port for a front-end connection and protocol and port for back-end connection. Elastic load balancing supports following protocols:
Configuring Elastic load balancing:
Idle Connection Timeout: When a client’s send request to load balancer, it maintains Connections, One connection between clients and Load balancer and another connection between Load balancer and EC2 instance. For each connection Load balancer manages an idle timeout which is triggered when no data is sent over connection for specified time period. , once idle time out is expired Load balancer closes that connection.
By default idle time out is 60 sec for both connection. If HTTP and HTTPS connection are going to be used, Keep-alive option must be enabled for your Amazon EC2 instances.
Cross-Zone Load Balancing: When it to be ensured that traffic is routed evenly across all back-end instances for your load balancer, regardless of your availability zones, you should enable Cross-Zone Load balancing.
Connection Draining: It is to ensure that load balancer stops sending request that are deregistering or healthy while keeping all existing connection open. When Connection draining is enabled, a maximum time is specified for load balancer to keep connection open while the EC2 instance is going to deregister or unhealthy. Maximum timeout can be set between 1 to 3600 Sec and default is 300 Sec.
Proxy Protocols: When request contains TCP or SSL connection for front end and backend , load balancer forwards forwards requests without modifying request headers , but if you enable Proxy protocols , It adds human-readable header to requests with connection information such as Source IP address , Dip and port numbers. And in this load balancer must not be behind proxy servers.
Sticky Sessions: When it is required to bind the user requests to particular Amazon EC2 instance, we should configure Sticky session’s features. In this it is required to provide how long load balancer should consistently route user’s traffic to same instance.
Health Check: Elastic load balancing providers the feature to test the health of Amazon EC2 instance. When the EC2 instance are “INSERVICE “then the instances are healthy. If the Instance health check are unhealthy then it is marked as “OUT OF SERVICE” and traffic is not sent to those instance.
Amazon Cloud Watch:
It is the service provide by Amazon to monitor AWS resources and application at real time. It provides track metrics, create Alarm, and send notification based on rule defined. Amazon cloud watch provides basic monitoring and detailed monitoring, Basic Monitoring sends data points to Amazon Cloud watch every five minutes where as detailed monitoring sends data points to cloud watch every minutes.
Amazon Cloud Watch supports monitoring and specific metrics for most AWS Cloud services, including: Auto Scaling, Amazon Cloud Front, Amazon Cloud Search, Amazon Dynamo DB, Amazon EC2, Amazon EC2 Container Service (Amazon ECS), Amazon Elastic ache, Amazon Elastic Block Store (Amazon EBS), Elastic Load Balancing, Amazon Elastic MapReduce (Amazon EMR), Amazon Elastic search Service, Amazon Kinesis Streams, Amazon Kinesis Firehose, AWS Lambda, Amazon Machine Learning, AWS OpsWorks, Amazon Redshift, Amazon Relational Database Service (Amazon RDS), Amazon Route 53, Amazon SNS, Amazon Simple Queue Service (Amazon SQS), Amazon S3, AWS Simple Workflow Service (Amazon SWF), AWS Storage Gateway, AWS WAF, and Amazon Workspaces.