# Delete an Object Storage Bucket

## Prerequisite

* มีการติดตั้ง s3cmd หรือ Cyberduck
* สร้าง subuser และ ให้สิทธิ์การเข้าถึง bucket เอาไว้แล้ว : ([ขั้นตอนการสร้าง subuser และ access key](https://docs-epc.gitbook.io/ncs-documents/~/changes/U2SVceQUXXCaek3t7CoE/object-storage/create-object-storage-sub-user))
* การ configuration s3cmd  ([การเข้าถึง S3 Bucket จาก s3cmd](https://docs-epc.gitbook.io/ncs-documents/storage/object-storage-s3/access-s3-bucket-with-s3cmd))

## Instruction

### 1. Clear the Bucket's data

ลบ object ใน bucket **ทั้งหมด**ก่อน ถ้ามีการ enable bucket Versioning ให้ทำการ suspend ก่อนทำการลบไฟล์โดยดูเพื่มเติมได้จาก [Bucket Versioning](https://docs-epc.gitbook.io/ncs-documents/storage/object-storage-s3/bucket-versioning)

1. ใช้ **s3cmd command line** `s3cmd del` ลบไฟล์ใน bucket\
   `s3cmd del s3://BUCKET/OBJECT`
2. ใช้ **Cyberduck** เข้าไปที่ bucket เเล้วลบ object **ทั้งหมด**
   1. เข้าไปที่ Cyberduck เเล้วคลิ๊กที่เครื่องหมาย **>** ที่อยู่หน้า bucket ที่เราจะลบซึ่งเราจะเห็นไฟล์ใน bucket<br>

      <figure><img src="/files/XZCu8jkaCOMGlAGFuraG" alt=""><figcaption></figcaption></figure>
   2. คลิ๊กขวาไฟล์ที่จะลบ\
      ![](/files/HyixN5oQ0n9TuB2HxBIl)<br>
   3. คลิ๊ก Delete เเล้วเลือก Delete จากนั้นไฟล์จะถูกลบ\
      ![](/files/GpfjsDqUV9Mwqs0hQtd8)

### 2. Delete the Bucket

เมื่อลบไฟล์หมดเเล้ว เราสร้างสามารถลบ bucket ได้ที่หน้า **Object Storage** ➝ **Buckets**\
![](/files/QkqbFHNyvgpj9CE3pfJP)\
\
กด MORE เเล้วจะเห็นปุ่ม Delete\
![](/files/lUFa69fXPiD1GUA0LnyL)\
\
กดปุ่ม Delete จะมี interface ขึ้นมาให้ใส่ชื่อ bucket ที่จะลบ เเล้วกด **PERMANENTLY DELETE**\
![](/files/fnsNdS6ip5cQlwckN1dZ)


---

# 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/storage/object-storage-s3/delete-an-object-storage-bucket.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.
