AWS Internal Load Balancer Using CLI

AWS Internal Load Balancer Using CLI

The Classic Load Balancer & Application Load Balancer are the external load balancers which could be access by external client over Internet having public IP addresses hence external load balancer routes the request from client over Internet but some times we need to load balance internal services which are not accessible by external clients.

For Example: In AWS bunch of micro services which is only used by AWS Infrastructure internally so to balance the load of these internal services we can use Internal Load Balancer.

The Internal load balancer only have private IP address and therefore internal load balancer only route request from client which have VPC access.

For Example: If our application has multiple tiers like web server connected to Internet and Database server that only connected to Web server. So in this case we can create a Internal Load Balancer for Database Server. Web Server will receive request from External Load Balancer and send request to Database Server via Internal Load Balancer and DB Server receives request from Internal Load Balancer and will respond to Web Server.

Internal-Load-Balancer-Flow


Lets see...

How To Create Internal Load Balancer Using AWS CLI:

>> aws elb create-load-balancer --load-balancer-name pgelbinternal --listeners "Protocol=HTTP,LoadBalancerPort=80,InstanceProtocol=HTTP,InstancePort=80" --scheme internal --subnets EnterSubnetsIds --security-groups EnterSecurityGroupID

To create internal load balancer we need to use following command and parameters:

Command : aws elb create-load-balancer

Parameters:

load-balancer-name : Load Balancer Name
listeners : Load balancer listener
scheme : In this parameter we need to pass value 'internal' because by default it will consider 'external' which means public internet facing load balancer.
subnets : Recommended Private Subnet Ids
security-group : Security group Ids

Output: It will show one DNS with prefix 'internal' like "internal-pgelbinternal-021252222.region.elb.amazonaws.com"

We can verify it from AWS management console by clicking on Load Balancer menu.

Lets see...

How To Register Instances With Internal Load Balancer:

>> aws elb register-instances-with-load-balancer --load-balancer-name pgelbinternal --instances EnterInstanceID

To register instance with internal load balancer we need to use following command and parameters:

Command: aws elb register-instances-with-load-balancer

Parameters:

load-balancer-name : Internal Load Balancer Name which we want to register with instance
instances : Instance Id which we want to register with Internal Load Balancer

We can verify it from AWS console by clicking 'Load Balancer' menu and click on "Instance" tab

How To De-register Instances From Internal Load Balancer:

>> aws elb deregister-instances-from-load-balancer --load-balancer-name pgelbinternal --instances EnterInstanceID

To de-register instance with internal load balancer we need to use following command and parameters:

Command: aws elb deregister-instances-from-load-balancer

Parameters:

load-balancer-name : Internal Load Balancer Name which we want to deregister from instance
instances : Instance Id which we want to deregister from Internal Load Balancer

We can verify it from AWS console by clicking 'Load Balancer' menu and click on "Instance" tab


How To Delete Internal / External Load Balancer Via AWS CLI:

>> aws elb delete-load-balancer --load-balancer-name pgelbinternal



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

Watch Video:

AWS Internal Load Balancer Using CLI AWS Internal Load Balancer Using CLI Reviewed by Web Technology Funda on 12:45:00 PM Rating: 5

No comments

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