> For the complete documentation index, see [llms.txt](https://docs-epc.gitbook.io/ncs-documents/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-epc.gitbook.io/ncs-documents/database-as-a-service/sql-database/auto-scaling-sql-database-storage/enable-auto-scaling.md).

# Enable Auto-Scaling

ตั้งค่าให้ Database Storage ขยายขนาดแบบอัติโนมัติ และกำหนดค่าต่าง ๆ เพื่อเป็นเงื่อนไขของ Auto-Scaling

## Instructions

### 1. เข้าสู่หน้า Database Instances&#x20;

เลือกรายการ “Database Instances” ที่ Sidebar จากเมนู SQL Database

<figure><img src="/files/LlACyaflgBPoPqcibV5I" alt=""><figcaption><p>เข้าหน้า Database Instances</p></figcaption></figure>

### 2. เข้าสู่หน้า Database Instance Detail&#x20;

เข้าไปที่หน้า Database Instance Detail ของ Database Instance ที่ต้องการทำคำสั่ง โดยต้องเป็น Database Instance ที่ไม่ได้ตั้งค่า Auto-Scaling ไว้

<figure><img src="/files/lF57T1NgDwF1qxUuEVGV" alt=""><figcaption><p>คลิกที่ชื่อของ Database Instance เพื่อเข้าหน้า Database Instance Detail </p></figcaption></figure>

### 3. เลือกคำสั่ง Enable Auto-Scaling

เลือกคำสั่ง Enable Auto-Scaling ภายใต้ปุ่ม “MANAGE” ที่มุมขวาบนของการ์ด Storage

<figure><img src="/files/AsorZ9MhYK8mCsvXMbQ1" alt=""><figcaption><p>เลือกคำสั่ง Enable Auto-Scaling</p></figcaption></figure>

### 4. กำหนด Auto-Scaling Limit&#x20;

หลังกดปุ่ม “ Enable Auto Scaling” ระบบจะแสดงหน้าต่าง หลังจากนั้นกำหนด Auto-Scaling Limit

<figure><img src="/files/fHUBW9X1aSk4XWhTDZq6" alt=""><figcaption><p>กำหนด Auto-Scaling Limit</p></figcaption></figure>

### 5. ตั้งค่า Advanced Setting

สามารถทำได้ 2 แบบ ดังนี้

### 5.1 เลือก Default setting&#x20;

ใช้ค่าเริ่มต้นที่ระบบแนะนำดังนี้

* Usage Threshold: 70%
* Increment Size: 10 GB
* Start Trigger: +30 นาที หลังจากเข้าหน้าต่าง Enable Auto Scaling
* Trigger Every: ทุก 15 นาที

<figure><img src="/files/soaRHuG38FDlrXtfsP3y" alt=""><figcaption><p>เลือก Default setting</p></figcaption></figure>

### 5.2 เลือก Custom setting

ต้องกำหนดค่าต่าง ๆ ดังนี้

* Usage Threshold: สามารถกำหนดได้ตั้งแต่ 10 ถึง 90 %
* Increment Size: สามารถกำหนดได้ตั้งแต่ 5-100 GB
* Start Trigger: สามารถกำหนดได้ตั้งแต่ +30 นาที หลังจากเข้าหน้าต่าง Enable Auto Scaling เป็นต้นไป
* Trigger Every: สามารถกำหนดได้ตั้งแต่ทุก 15 นาที, 30 นาที, 1 ชั่วโมง, 2 ชั่วโมง, 3 ชั่วโมง, 6 ชั่วโมง และ 12 ชั่วโมง

<figure><img src="/files/WqJRZnC5vQu0P3ji5YmP" alt=""><figcaption><p>เลือก Custom setting</p></figcaption></figure>

### 6. ตรวจสอบความถูกต้องแล้วยืนยันการตั้งค่า Auto-Scaling

ตรวจสอบความถูกต้องของการตั้งค่า และกดปุ่ม "ENABLE" เพื่อเริ่ม Auto-Scaling

<figure><img src="/files/NrMghPyhAWcFxPkwsXtx" alt=""><figcaption><p>กดปุ่ม ENABLE</p></figcaption></figure>

### 7. Database Instance สามารถ Auto-Scaling Storage หลังการตั้งค่าสำเร็จ

เมื่อการตั้งค่าสำเร็จ ระบบแสดง Auto-Scaling เป็น Enabled ที่การ์ด Storage หน้า Database Instance Detail&#x20;

<figure><img src="/files/hKBs7ywDOX80iXiPyKHz" alt=""><figcaption><p>ระบบแสดง Auto-Scaling เป็น Enabled และแสดงตัวแปรที่กำหนด</p></figcaption></figure>

หลังตั้งค่าครั้งแรกจะทำให้เกิด Schedule และสถานะเป็น Active ซึ่งเป็น Schedule ที่ไม่สามารถจัดการได้ผ่านหน้า Schedule การจัดการที่เกี่ยวกับ Auto-Scaling Storage จะต้องทำที่หน้า Database Instance Detail เท่านั้น&#x20;

<figure><img src="/files/ZjcjKjafldJgbAjfTzU8" alt=""><figcaption><p>Schedule ของ Auto-Scaling Storage</p></figcaption></figure>

{% hint style="info" %}
สามารถตรวจสอบผลลัพธ์การทำงานของ Auto-Scaling Storage ที่หน้า Job
{% endhint %}

<figure><img src="/files/SfYLX6k7aDeq1Ko4WKIo" alt=""><figcaption><p>ตัวอย่างผลลัพธ์ของ Auto-Scaling Storage</p></figcaption></figure>
