# Cloud-aws plugin overwrites snapshots

**URL:** <https://discuss.elastic.co/t/cloud-aws-plugin-overwrites-snapshots/52462>\
**Category:** Elasticsearch\
**Created:** [June 10, 2016, 4:04pm UTC](https://discuss.elastic.co/t/cloud-aws-plugin-overwrites-snapshots/52462 "2016-06-10T16:04:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajays20078](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@ajays20078](https://discuss.elastic.co/u/ajays20078)\
**Post date:** [June 10, 2016, 4:04pm UTC](https://discuss.elastic.co/t/cloud-aws-plugin-overwrites-snapshots/52462/1 "2016-06-10T16:04:16Z")

</div>

The Cloud Aws [plugin](https://github.com/elastic/elasticsearch/tree/2.0/plugins/cloud-aws) , overwrites the earlier snapshots in the bucket. Doesn't it impact restore operation? Or is this the expected behaviour? Also how do we purge snapshot older than x days, is purging files older than x days equivalent of it?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 10, 2016, 4:55pm UTC](https://discuss.elastic.co/t/cloud-aws-plugin-overwrites-snapshots/52462/2 "2016-06-10T16:55:31Z")

</div>

Every time you run a new snapshot, it copies the new "files" (new segments) to the the repository and basically link the snapshot with this set of files (existing ones and new ones).

If you remove a snapshot, it will look at all files and will remove the ones which are not used anymore by any of the remaining snapshots.

When you restore a snapshot, it will restore all the files linked to this snapshot.

You should never try to remove manually files in the repository but let the snapshot API do the right job for you.

HTH

---

<div class="post-metadata">

**Author:** ![ajays20078](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@ajays20078](https://discuss.elastic.co/u/ajays20078)\
**Post date:** [June 10, 2016, 5:15pm UTC](https://discuss.elastic.co/t/cloud-aws-plugin-overwrites-snapshots/52462/3 "2016-06-10T17:15:50Z")

</div>

What happens in the following Case:

- some files(data/indices) are deleted from Elastic search.

- Followed by compaction(optimize).

- Followed by new snapshot.

Does the API ensure the removed files are retained in s3 bucket since they are being referred by earlier snapshots?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 10, 2016, 6:03pm UTC](https://discuss.elastic.co/t/cloud-aws-plugin-overwrites-snapshots/52462/4 "2016-06-10T18:03:55Z")

</div>

Yes. It does.

Old segments which contain old data are still referenced by a snapshot so they are kept around until you remove all the snapshots which refer to it.

---

<div class="post-metadata">

**Author:** ![ajays20078](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@ajays20078](https://discuss.elastic.co/u/ajays20078)\
**Post date:** [June 11, 2016, 6:34am UTC](https://discuss.elastic.co/t/cloud-aws-plugin-overwrites-snapshots/52462/5 "2016-06-11T06:34:51Z")

</div>

Alright. Thanks for explaining it in detail.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:44pm UTC](https://discuss.elastic.co/t/cloud-aws-plugin-overwrites-snapshots/52462/6 "2017-07-05T22:44:37Z")

</div>


