# Using Application Load Balancing

## Prerequisite

* มียอดคงเหลือใน Project มากกว่า 0 บาท ([ขั้นตอนการเติมเงินเข้าสู่ Project](/ncs-documents/nipa-cloud-space-overview/billing-and-wallet/topup-a-project-wallet.md))
* มี Load Balancer พร้อมใช้งาน ([ขั้นตอนการสร้าง Load Balancer](/ncs-documents/load-balancing/load-balancer/create-load-balancer.md))

## Instructions

### 1. เข้าสู่หน้าสร้าง Backend Group&#x20;

ในหน้า Load Balancer Detail ที่ tab Overview จะแสดงรายละเอียดของ Load Balancer โดยจะต้องสร้าง Backend Group เพื่อเริ่มใช้งาน โดยกดปุ่ม CREATE BACKEND GROUP ที่แถบ menu ด้านบน หรือ instruction card ที่ด้านขวาบน

<figure><img src="/files/nBE10HaQ5fOy6u1kVeRB" alt=""><figcaption><p>Load Balancer Overview - Create Backend Group Button</p></figcaption></figure>

### 2. ตั้งค่า Backend Group

ในหน้าสร้าง Backend Group ให้เลือก Protocol เป็น HTTP โดยใช้ได้กับ Listener ที่ใช้ Protocol เป็น HTTP และ HTTPS ในการรับ load จากภายนอก Load Balancer

พร้อมกำหนดชื่อและ Algorithm ของ Backend Group

<figure><img src="/files/GtMR9YdVRc0hRRRxgSHe" alt=""><figcaption><p>Create Backend Group - Backend Group</p></figcaption></figure>

### 3. ตั้งค่า Health Check

เลือกว่าจะเปิดใช้งาน Health Check ที่จะคอยเช็คสถานะของ member ภายใน Backend Group และกำหนดความถี่ และรูปแบบของการทำ Health Check

<figure><img src="/files/BjQGBwP31JG77ZZjWsGH" alt=""><figcaption><p>Create Backend Group - Health Check</p></figcaption></figure>

### 4. ตั้งค่า Members

เลือก IP Address และ Port ที่จะรับ load จาก Load Balancer จากนั้นกด CREATE เพื่อยืนยันการสร้าง Backend Group

<figure><img src="/files/9cBoV4BIKP2RZz1Q1Utk" alt=""><figcaption><p>Create Backend Group - Members</p></figcaption></figure>

{% hint style="info" %}
สถานะของ Backend Group member จะเป็น Disable จนกว่าจะมีการต่อใช้งานกับ Listener
{% endhint %}

### 5. เข้าสู่หน้าสร้าง Listener

ระบบจะพามาหน้า Load Balancer Detail ที่ tab Backend Group รอจนกว่า Load Balancer จะไม่ขึ้น Updating จากนั้นกดปุ่ม CREATE LISTENER

<figure><img src="/files/IICfB6sZqjMF4AhomFW2" alt=""><figcaption><p>Load Balancer Backend Group - Create Listener Button</p></figcaption></figure>

### 6. ตั้งค่า Listener

ในหน้า Create Listener กำหนด Protocol เป็น HTTP หรือ HTTPS กำหนด Port เลือก Backend Group ที่ใช้ Protocol เดียวกัน และ ตั้งค่าอื่น ๆ จากนั้นกด CREATE เพื่อยืนยันการสร้าง Listener

<figure><img src="/files/PcF3G9iI40qVuub7UHNX" alt=""><figcaption><p>Create HTTP Listener</p></figcaption></figure>

โดยในกรณีที่ใช้ Protocol เป็น HTTPS จะต้องมีการระบุ SSL Certificate ที่จะใช้ในการ terminate HTTPS ที่ Listener นี้ด้วย

<figure><img src="/files/WTi9mfZQWcSjS89RehsG" alt=""><figcaption><p>Create HTTPS Listener</p></figcaption></figure>

### 7. รอจน Listener สร้างสำเร็จ

รอจนกว่า Load Balancer จะไม่ขึ้นว่า Updating ก็ถือเป็นอันเสร็จสิ้น โดยในตอนนี้ ถ้ามี load เข้ามาที่ Load Balancer นี้ ผ่าน VIP หรือ external IP หากมี port number เดียวกันกับ Listener ที่สร้างไว้ load ก็จะถูกส่งไปยัง Member หนึ่งของ Backend Group นี้ ตาม Algorithm ที่เลือกไว้

<figure><img src="/files/bjlse4SVV6rXNt2i6HAO" alt=""><figcaption><p>Load Balancer Listener</p></figcaption></figure>

{% hint style="info" %}
สามารถทวนขั้นตอนนี้ใหม่อีกครั้ง เพื่อรับ load ใน Protocol และ Port อื่น ๆ โดยใน 1 Load Balancer สามารถทำงานได้ทั้ง Network Load Balancing และ Application Load Balancing ขึ้นอยู่กับ Backend Group และ Listener
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-epc.gitbook.io/ncs-documents/load-balancing/load-balancer/using-application-load-balancing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
