Create Classic Load Balancer Using AWS CLI [Part-2]

Classic Load Balancer Using AWS CLI

In last session we have seen how to create Application Load Balancer using "elbv2" command.

Classic Load Balancer is used to route traffic, based on applications or network level details.

It is best option for simple load balancing traffic across multiple EC2 instances where high availability, auto scaling and robust security are basic requirement of application.

It works under 4th layer of OSI model which is Transport Layer and supports TCP, SSL, HTTP, HTTPS protocols.

Classic Load Balancer supports command "aws elb" without v2 version operation where as in last session for Application Load Balancer we used command "aws elbv2".

>> aws elb create-load-balancer --load-balancer-name pgLoadBalClassic --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80" --subnets EnterSubnetsIds --security-group EnterSecurityGroupID

Following are the command and parameters to create Classic Load Balancer:

Command: aws elb create-load-balancer

Parameters:

load-balancer-name: Set load balancer name

listeners: Set listeners for load balancer

Note: In Classic Load Balancer, We are specifying listeners while creating classic load balancer and in case of Application Load Balancer first we created listener separately then register that with load balancer.

Protocol & Port: 

We configured FrontEnd protocol (Protocol=HTTP,LoadBalancerPort=80) that means client request will convert to load balancer via HTTP protocol on port 80.

Also we configured BackEnd protocol (InstanceProtocol=HTTP,InstancePort=80) that means connection between ELB and instances via HTTP protocol on port 80.

subnets: Provide your VPC subnet ids. Specify one subnet per Availability Zone specified

security-group: Provide security group ID

SSLCertificateId: This parameter is only use for HTTPS listener

Output:

{
    "DNSName": "pgLoadBalClassic......elb.amazonaws.com"
}

This DNS address which AWS has been assigned to our new classic load balancer.

You can verify it from aws management console by clicking on "Load Balancer" menu.

Lets see, how to create new listener for existing Classic Load Balancer:

To create new load balancer listener we need to specify name of existing load balancer and specify listener configuration for FrontEnd and BackEnd protocols.

>> aws elb create-load-balancer-listeners --load-balancer-name pgLoadBalClassic --listener "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80"

lets verify it from aws management console by clicking on "Load Balancer" menu.

Happy Learning AWS Services!!!! :) Still Doubts? lets put your questions in below comment box! Thanks!

Watch Video:


Create Classic Load Balancer Using AWS CLI [Part-2] Create Classic Load Balancer Using AWS CLI [Part-2] Reviewed by Pranay Gondane on 9:36:00 AM Rating: 5

No comments

Free! Free!Free! Subscribe to Get Free PHP (Magento) tutorial Update in Your Inbox!!! Hurry Up!!!