In today’s post, will see the Public Load balancer configuration in Oracle Cloud Infrastructure.
Will create Public load balancer in which my two web servers will be there and work in round robin fashion.
My compartment is PROD_COMPARTMENT in FRANKFURT Region.
- PROD_COMPARTMENT created.
- Create VCN01_PROD with CIDR 10.0.0.0/16
- Create below subnets in VCN01_PROD
- SUBNETA_PUBLIC_PROD with CIDR 10.0.1.0/24
- SUBNETB_PUBLIC_PROD with CIDR 10.0.2.0/24
- SUBNETC_PUBLIC_PROD with CIDR 10.0.3.0/24
- Create Internet Gateway as IGW01_PROD.
- Add the rule of IGW01_PROD internet Gateway in the default route table which was created at the time of VCN01_PROD creation.
- Create PROD_WEBSERVER01 instance using SUBNETA_PUBLIC_PROD of VCN01_PROD.
- Create PROD_WEBSERVER02 instance using SUBNETB_PUBLIC_PROD of VCN01_PROD.
- Now, after successful creation of instances, create a security list PROD_SECURITY_LIST_LB with empty rules (Rules will be created automatically when we are creating backend sets of Load Balancer).
- Create a route table PROD_RT01_LB and add the rule of internet gateway IGW01_PROD.
- Create subnets as below which will be used for Load Balancer.
- LBSUBNET1_PUBLIC_PROD with CIDR 10.0.4.0/24
- LBSUBNET2_PUBLIC_PROD with CIDR 10.0.5.0/24
- When creating above subnets use the route table as PROD_RT01_LB and security list as PROD_SECURITY_LIST_LB.
- Now, create the public load balancer PROD_LB using the subnets LBSUBNET1_PUBLIC_PROD, LBSUBNET2_PUBLIC_PROD of VCN01_PROD.
- Create the backend set as PROD_BS and add the backend servers PROD_WEBSERVER01, PROD_WEBSERVER02.
- Create the listener PROD_LISTENER01 with port 80 for the backend set PROD_BS.
- Add the security rule to allow the ingress connection of port 80 in the PROD_SECURITY_LIST_LB.
- Now, for testing, I installed httpd server in my two instances.
- Once httpd server installation was done, do the load balancer testing with the public ip address of the Load Balancer.
Instances created in my PROD_COMPARTMENT.
Create an empty security list in the VCN.
PROD_SECURITY_LIST_LB created successfully.
Create a new route table and assign Internet Gateway rule for the load balancer which we are going to create.
Route table PROD_RT01_LB created successfully.
Now create two Public subnets using the above created security list and route table, each in different AD as the Public load balancer will deploy in two subnets for High Availability.
LBSUNET1_PUBLIC_PROD created successfully.
LBSUNET2_PUBLIC_PROD created successfully.
Now, create Load balancer with the listener, backend set and backend servers.
PROD_LB successfully created.
After successful creation of Load balancer, go to backend set and edit the backends to give the OCID of the instances which will be served by the load balancer.
Once you give the information of OCID of the instances, wait till the backend set to update.
After that submit the security list rules below.
Successfully backend set created with the below instances.
Now go the PROD_SECURITY_LIST_LB and create an ingress rule.
Now, for load balance testing, installing httpd server on PROD_WEBSERVER01 and PROD_WEBSERVER02 instances.
Below showing the commands only on PROD_WEBSERVER01, same activity has to be done on PROD_WEBSERVER02 which I did successfully.
Now, copy the load balancer public ip address and fire in the browser, where it should have to pick up the index.html file of the httpd server and show the output.
So, we are able to do load balancing successfully using Public Load Balancer.
Hope these posts find you well!!
Firoz Hussain k.