> 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/scheduling/schedules/create-schedule.md).

# Create Schedule

Schedule เป็นการตั้งเวลาสำหรับการทำ action บางอย่างกับ resource ล่วงหน้า  เช่น การ Start/Stop/Restart Compute Instance

{% hint style="info" %}
การ Stop Compute Instance จะเป็นการคืน resource ของ Instance Machine Type สู่ระบบ ทำให้ได้รับการละเว้นการคิดเงิน Machine Type แต่การคิดเงินอื่นๆ เช่น Image License, Volume และ External IP จะยังคงคิดเงินตามปกติ
{% endhint %}

{% hint style="warning" %}
การ Stop Compute Instance จะเป็นการคืน resource สู่ระบบ ทำให้มีความเสี่ยงที่จะทำให้ไม่สามารถ Start Compute Instance กลับมา หาก Machine Type ของ Compute Instance มี resource ไม่เพียงพอ
{% endhint %}

## Prerequisite

* มียอดคงเหลือใน Project มากกว่า 0 บาท ([ขั้นตอนการเติมเงินเข้าสู่ Project](/ncs-documents/nipa-cloud-space-overview/billing-and-wallet/topup-a-project-wallet.md))
* มี resource ที่จะเป็น target ของ Schedule ที่ต้องการ

## Instructions

### 1. เข้าสู่ Project

เลือก project จากหน้า Projects Management เพื่อเข้าสู่หน้า Project Detail

<figure><img src="/files/TKObK0IYTanQnOLlXfvQ" alt=""><figcaption><p>Project Detail</p></figcaption></figure>

### 2. เข้าสู่หน้า Schedules

เลือกรายการ “Schedules” ที่ Sidebar จากเมนู SCHEDULING

<figure><img src="/files/XkUKIMCMFavILiaAWId2" alt=""><figcaption><p>Schedule List</p></figcaption></figure>

### 3. เข้าหน้า create Schedule

เข้าหน้า create Schedule ด้วยปุ่ม "CREATE" ที่มุมขวาบนของหน้า Schedules

<figure><img src="/files/ohxzgzMyZt5hl3C0BIcl" alt=""><figcaption><p>Create Schedule</p></figcaption></figure>

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

ภายในหน้า Schedule ทำการตั้งค่าดังนี้

1. **Schedule Name**: ชื่อของ Schedule ที่จะแสดงในหน้า Schedules และ หน้า Jobs ที่เป็นรายการผลลัพท์
2. **Description**: คำอธิบายเพิ่มเติมของ Schedule
3. **Event**: กิจกรรมที่ต้องการทำ
4. **Ocurrence**: รูปแบบการทำงาน ที่จะทำครั้งเดียวแบบ One-time หรือทำซ้ำแบบ Repeat
5. **Target**: resource ที่จะทำตาม event

<figure><img src="/files/jx45B7ST7joryx8lT2kP" alt=""><figcaption></figcaption></figure>

รายละเอียดเวลาทำงานของ Schedule จะเปลี่ยนไปตาม Occurrence ที่เลือก ดังนี้

#### One-time

จะเป็น Schedule ที่ทำงานแค่ครั้งเดียว ตามเวลาที่กำหนดไว้ในตัวเลือก Start Schedule

<figure><img src="/files/6RporHc66OD36Nk3KHLA" alt=""><figcaption><p>One-time</p></figcaption></figure>

#### Repeat

แบ่งได้อีก 3 แบบ คือ

1. Repeat Daily

เมื่อเลือก frequency เป็น 1 Day ซึ่งจะทำให้ Schedule นี้ทำงานทุกวัน ตามเวลาที่กำหนดไว้ใน Start Schedule

<figure><img src="/files/DczGdefetoQMdgBgSVhL" alt=""><figcaption><p>Repeat Daily</p></figcaption></figure>

2. Repeat Weekly

เมื่อเลือก frequency เป็น 1 Week ซึ่งจะทำให้ Schedule นี้ทำงานทุกสัปดาห์ โดยจะทำในวัน และเวลาแรกที่กำหนดไว้ใน Start Schedule และทำงานครั้งถัดไปตามวันในสัปดาห์ที่กำหนดไว้ใน Action Day

<figure><img src="/files/JOPVjIvF3ZuB77B7Urrr" alt=""><figcaption><p>Repeat Weekly</p></figcaption></figure>

3. Repeat Monthly

เมื่อเลือก frequency เป็น 1 Month ซึ่งจะทำให้ Schedule นี้ทำงานทุกเดือน โดยจะทำในวัน และเวลาแรกที่กำหนดไว้ใน Start Schedule และทำงานครั้งถัดไปตาม pattern ที่กำหนด

<figure><img src="/files/JkGpZwp3xYxSufMwXjOb" alt=""><figcaption><p>Repeat Monthly</p></figcaption></figure>

### 5. Confirm การสร้าง Schedule

เมื่อตั้งค่าตามต้องการแล้ว ให้กดปุ่ม "CREATE" ที่มุมขวาล่างของหน้าต่าง เพื่อยืนยัน

ระบบจะแสดงสรุปของ Schedule ที่พึ่งสร้าง และ Schedule ดังกล่าวจะแสดงอยู่ในหน้า Schedules

<figure><img src="/files/zJtTdTVfU0EUWGhMfuYF" alt=""><figcaption><p>Schedule Created</p></figcaption></figure>
