The public Load balancer in Oracle OCI !!

Hi Guys,

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 Environment:

My compartment is PROD_COMPARTMENT in FRANKFURT Region.

  1. PROD_COMPARTMENT created.
  2. Create VCN01_PROD with CIDR
  3. Create below subnets in VCN01_PROD
  1. Create Internet Gateway as IGW01_PROD.
  2. Add the rule of IGW01_PROD internet Gateway in the default route table which was created at the time of VCN01_PROD creation.
  3. Create PROD_WEBSERVER01 instance using SUBNETA_PUBLIC_PROD of VCN01_PROD.
  4. Create PROD_WEBSERVER02 instance using SUBNETB_PUBLIC_PROD of VCN01_PROD.
  5. 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).
  6. Create a route table PROD_RT01_LB and add the rule of internet gateway IGW01_PROD.
  7. Create subnets as below which will be used for Load Balancer.
  1. When creating above subnets use the route table as PROD_RT01_LB and security list as PROD_SECURITY_LIST_LB.
  2. Now, create the public load balancer PROD_LB using the subnets LBSUBNET1_PUBLIC_PROD, LBSUBNET2_PUBLIC_PROD of VCN01_PROD.
  3. Create the backend set as PROD_BS and add the backend servers PROD_WEBSERVER01, PROD_WEBSERVER02.
  4. Create the listener PROD_LISTENER01 with port 80 for the backend set PROD_BS.
  5. Add the security rule to allow the ingress connection of port 80 in the PROD_SECURITY_LIST_LB.
  6. Now, for testing, I installed httpd server in my two instances.
  7. 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.

PROD_WEBSERVER01 instance:

PROD_WEBSERVER02 instance:

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!!

Happy learning!!

Firoz Hussain k.

Add Your Comment