# Amazon S3 orphan images not removing

**URL:** https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914
**Category:** Support
**Created:** [3월 12, 2017, 6:25오전 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914 "2017-03-12T06:25:50Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Vikas\_Dangi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vikas_dangi/32/131628_2.png) [@Vikas\_Dangi](https://meta.discourse.org/u/Vikas_Dangi)
#### Post date: [3월 12, 2017, 6:25오전 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/1 "2017-03-12T06:25:50Z")

</div>

Remove orphan unreferenced uploads is checked in my forum but still the orphan images are not removing automatically.

To check this I have uploaded a images yesterday to my forum but still it is accessible.

`defenceforum-img-s3.s3-ap-south-1.amazonaws.com/original/1X/b2597229c427eead298ccb553a44ce92c2190e28.jpg`

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 12, 2017, 6:32오전 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/2 "2017-03-12T06:32:35Z")

</div>

I don’t think we remove from S3, just local.

---

<div class="post-metadata">

### Author: ![Vikas\_Dangi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vikas_dangi/32/131628_2.png) [@Vikas\_Dangi](https://meta.discourse.org/u/Vikas_Dangi)
#### Post date: [3월 12, 2017, 6:36오전 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/3 "2017-03-12T06:36:56Z")

</div>

Then how can I protect my s3 from illegal hosting

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [3월 12, 2017, 11:53오전 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/4 "2017-03-12T11:53:42Z")

</div>

Cleaning up orphan uploads _should_ work for both local and S3 storages.

The only difference between the local and S3 storages is that the cleanup of the tombstone is automatically handled by S3 via a [policy](https://github.com/discourse/discourse/blob/3141c179f727772bf32798b48f5355918c3924b4/lib/s3_helper.rb#L49-L66).

@Vikas_Dangi have you enabled the `clean_up_uploads` site setting? Are you sure that image isn’t used somewhere else (avatar, user profile, category image, etc..)?

---

<div class="post-metadata">

### Author: ![Vikas\_Dangi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vikas_dangi/32/131628_2.png) [@Vikas\_Dangi](https://meta.discourse.org/u/Vikas_Dangi)
#### Post date: [3월 12, 2017, 5:26오후 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/5 "2017-03-12T17:26:41Z")

</div>

Yes the clean up upload is enabled and the grace period hours is set to 1. But the images are still not removing.

> [@zogstrip](#):
>
> Are you sure that image isn’t used somewhere else (avatar, user profile, category image, etc..)?

I have uploaded the image to just check the functionality, so i have not used the image in any post, avatar or other.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [3월 12, 2017, 7:23오후 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/6 "2017-03-12T19:23:37Z")

</div>

I’m not understanding. You uploaded but didn’t use?  
How did you upload it?

---

<div class="post-metadata">

### Author: ![Vikas\_Dangi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vikas_dangi/32/131628_2.png) [@Vikas\_Dangi](https://meta.discourse.org/u/Vikas_Dangi)
#### Post date: [3월 12, 2017, 7:26오후 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/7 "2017-03-12T19:26:46Z")

</div>

I have uploaded it through upload button. But didn’t posted it in the topic, so it became orphan image. But my problem is that the orphaned imaged not removing automatically.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [3월 12, 2017, 7:34오후 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/8 "2017-03-12T19:34:35Z")

</div>

Correct me if I’m wrong.

- you opened the composer
- you uploaded the image via the upload icon
- then canceled the post

i.e. The image is not being removed from the Draft

---

<div class="post-metadata">

### Author: ![Vikas\_Dangi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vikas_dangi/32/131628_2.png) [@Vikas\_Dangi](https://meta.discourse.org/u/Vikas_Dangi)
#### Post date: [3월 12, 2017, 7:38오후 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/9 "2017-03-12T19:38:46Z")

</div>

Yes your 3 points are correct. But the image is not removing from the s3 server.

---

<div class="post-metadata">

### Author: ![Vikas\_Dangi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vikas_dangi/32/131628_2.png) [@Vikas\_Dangi](https://meta.discourse.org/u/Vikas_Dangi)
#### Post date: [3월 12, 2017, 9:17오후 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/10 "2017-03-12T21:17:06Z")

</div>

now its working thanks.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [6월 8, 2024, 12:44오후 UTC](https://meta.discourse.org/t/amazon-s3-orphan-images-not-removing/58914/11 "2024-06-08T12:44:50Z")

</div>

이 주제는 2645일 후 자동으로 닫혔습니다. 더 이상 새 답변을 게시할 수 없습니다.
