# Example Use Case

This section explains an example case of **Deka SLB** configuration using the **Roundrobin** method type with two VM Instances in the Cloudeka portal service. There are several stages that will be carried out in the case of using the Deka SLB configuration on the Cloudeka portal service.

## **VPC Configuration**

The first step is to add VPC configuration on the project that will be created by Deka SLB, you can click for further explanation on how to create a VPC [this link ](https://docs.cloudeka.id/deka_flexi/deka-flexi-network/6.1_vpc_network/create-vpc-network)to go to the Create VPC module.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.39%20a-create-vpc.png" alt=""><figcaption><p>VPC Configuration</p></figcaption></figure>

## **VM Configuration**

The next step is to **Add two VM in the Instance** using the same VPC, which is **vpc-demo-slb**. For further explanation on how to create a VM, you can press [this link](https://docs.cloudeka.id/deka_flexi_compute/create-a-vm-instance#create-instance-from-public-image) to go to the Create VM module.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.40%20create-vm.png" alt=""><figcaption><p>Virtual Machine</p></figcaption></figure>

The VM on the instances that have been created are demo-slb1 and demo-slb2, console access on the demo-slb1 and demo-slb2 VMs. Press the More button then select Access Console.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.41%20access-console.png" alt=""><figcaption><p>Access Console</p></figcaption></figure>

Enter the username and password used to log in to the virtual machine.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.42%20access-console-login.png" alt=""><figcaption><p>Access Console - Login</p></figcaption></figure>

Enter the following command to update the package management version that the VM will use.

```
sudo apt-get update 
```

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.43%20access-console-login-install(a).png" alt=""><figcaption><p>Update Packet</p></figcaption></figure>

Enter the following command to install the Apache HTTPServer package on the VM.

```
sudo apt-get install apache2
```

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.44%20access-console-login-install(b).png" alt=""><figcaption><p>Install Apache2</p></figcaption></figure>

Type Y to continue the installation process.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.45%20choose-Y.png" alt=""><figcaption><p>Install Apache2</p></figcaption></figure>

Press Enter to continue the installation process and wait until the process is complete.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.47%20process-install.png" alt=""><figcaption><p>Install Apache2</p></figcaption></figure>

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.46%20install-apache-process.png" alt=""><figcaption><p>Install Apache2</p></figcaption></figure>

After you have finished installing Apache, next, check the status that Apache has been installed, enter the command below.

```
systemctl status apache2
```

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.48%20status-apache.png" alt=""><figcaption><p>Check Status Apache2</p></figcaption></figure>

After Apache is running on each VM, the next step is to add a file to the html directory. Later, the file created in this html directory will be added to the Backend configuration in the Load Balancer under the Http Check URI column. Enter the following syntax to access the html directory.

```
cd /var/www/html
```

<figure><img src="https://lh7-us.googleusercontent.com/QJf_fKyVocuZ1-tF_LqewwwFAL7tn4KYaIh5jaBayydSEAKfU3dB2P-1pseVMquNXK1sFIaS17fC6oLWfcI2Era--Nvr1ReMXbggaC5PquJGhC7FJmuJ2guUHRjcwyYkLDE4KvzQm5seJ74rfdkLSWU" alt=""><figcaption><p>Add file</p></figcaption></figure>

Enter the following command syntax to create a file in the html directory.

```
sudo nano [name-file].[ekstensi-file]
```

<figure><img src="https://lh7-us.googleusercontent.com/juHZYSB8U-JQkCX1jax2lkxe7I4JdxX744qqrOO64Alsz-Q0bdOFnxbAPM7xM1vndD57q8U3ra_X7GGe6FiofYqUGLSwo-f7zCiI4mZb5UtEYa7E5JXXnQ9R-VLE9k6H-lqDt4ngd1vYlW9IGJo7e8I" alt=""><figcaption><p>Add file</p></figcaption></figure>

Enter the contents of the file in each VM

<figure><img src="https://lh7-us.googleusercontent.com/8D0xDjT-d72dTMC4zVOfSwcKHY63BeHe83Kqhsyrfx-wNu9eUC32xMpifK5LGyqYwYZisDTDMIapsPyDEo7MtayBzhwTElKqy09rEbHXt1gEWk8nqv3Ne_prVzlZU_9gdtHspLrzWBt8DDGRlEElOak" alt=""><figcaption><p>Add file</p></figcaption></figure>

To exit the configuration file main.php, on the keyboard press the CTRL key and the X key simultaneously. Press the Y and Enter keys to save the file contents.

## **Deka SLB Configuration**

The next step is to add a load balancer configuration using the Server Load Balancer type via the Network menu.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.49%20load-balancer.png" alt=""><figcaption><p>SLB Configuration</p></figcaption></figure>

It can be seen that after adding the Deka SLB configuration, the IP address is 109.199.214.217 which will later be added to the Security Firewall. In the SLB configuration, add HTTP configuration to the backend and frontend.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.50%20load-balancer-be.png" alt=""><figcaption><p>BE Configuration</p></figcaption></figure>

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.51%20load-balancer-fe1.png" alt=""><figcaption><p>FE Configuration</p></figcaption></figure>

## **Security Configuration**

On the Security menu, press the Create Security button, in the Inbound Rule section, press the New Rule button to add the IP address obtained after successfully creating the Deka SLB configuration.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.52%20create-sec.png" alt=""><figcaption><p>Security Configuration</p></figcaption></figure>

For the Apply to Instance section, add it to the previously created VM.

<figure><img src="https://putri.box.cloudeka.id/cloudeka-assets/static/images/13slb/13.59%20sec-group.png" alt=""><figcaption><p>Security Configuration</p></figcaption></figure>

## Result

After completing all the configurations above, check whether the web server is running according to the configuration. Open the browser on your computer, enter the IP address obtained in the load balancer configuration, namely **109.190.214.217** and the name of the file created in the html directory, namely main.php. Enter the following syntax in your browser.

```
109.190.214.217/main.php
```

<figure><img src="https://lh7-us.googleusercontent.com/BK3f7GAxxRS2_MLoQkEOQaL7rpjTeBvheclj6cUUivOV2ghfjHhxDm2HQdSGgjME1CG5Ytuil8s1CB94IFr_m4zM_Q-iEecTf3U01UbQQyQfuSPWmfaTxMVvO-nuQC9SSUYGYqnugcJ1gkSInQSnbe0" alt=""><figcaption><p>Result</p></figcaption></figure>

<figure><img src="https://lh7-us.googleusercontent.com/bd0PE93y8J5fLkjzhYM6noiSL_V96T9VRP7aHHwVOTWnSelb3rRS66n4-RnCzaX-xgdQ6uoLuyKAPP9FqXzRmfWhVVntp_07fvNUQrL-4kXRhDmFxwe-WVpmaapxZt0-6QJzuHf6DI4fJWtOztqK8kQ" alt=""><figcaption><p>Result</p></figcaption></figure>
