# How to automate the Rollover index API in AWS Elastic search

**URL:** <https://discuss.elastic.co/t/how-to-automate-the-rollover-index-api-in-aws-elastic-search/169401>\
**Category:** Elasticsearch\
**Created:** [February 21, 2019, 11:34am UTC](https://discuss.elastic.co/t/how-to-automate-the-rollover-index-api-in-aws-elastic-search/169401 "2019-02-21T11:34:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![winny](https://avatars.discourse-cdn.com/v4/letter/w/53a042/32.png) [@winny](https://discuss.elastic.co/u/winny)\
**Post date:** [February 21, 2019, 11:34am UTC](https://discuss.elastic.co/t/how-to-automate-the-rollover-index-api-in-aws-elastic-search/169401/1 "2019-02-21T11:34:50Z")

</div>

Hi,

I am very new to elastic search. We are using ES to store messages coming from our App. Here is how my index looks like  
PUT message\_history\_index  
{  
"mappings":{  
"notification\_history" : {  
"dynamic": "strict",  
"properties":{  
"account\_id":{  
"type": "integer"  
},  
"user\_id": {  
"type": "integer"  
},  
"created\_when": {  
"type": "date",  
"format": "date\_time"  
}

```
        }
    }
}

```

}  
I want to create monthly indexes and I am trying to automate this. So that at the end of every month there will be automated process to create an index.So all documents created this month will be in **message\_history\_index-2019.02-1**

I created a template to create time series index and the used the rollover api to create to do this

PUT \_template/message\_history\_index\_template  
{  
"template": "message\_history\_index-\*",  
"settings": {  
"number\_of\_shards": 5,  
"number\_of\_replicas": 0  
},  
"aliases": {  
"search\_message\_history": {}  
}  
}

POST active\_message\_history/\_rollover  
{  
"conditions": {  
"max\_age": "30d"  
}  
}

But my problem is that now ill have to manually execute the rollover after every 30 days for it to create the new index.  
Is there any way of automating the rollover api in AWS?  
How do I create a cron job in AWS to automate this rollover process?

Thanks in advance

---

<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:** [February 21, 2019, 11:50am UTC](https://discuss.elastic.co/t/how-to-automate-the-rollover-index-api-in-aws-elastic-search/169401/2 "2019-02-21T11:50:04Z")

</div>

In Elasticsearch 6.6 you have now a UI and tools to automate that from Kibana. See `Management -> Elasticsearch -> Index Lifecycle Management`

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/9/29b2c6cf2bc503aef983e00b6d9444476337a09d.jpeg)

Note that this is available in [https://www.elastic.co/cloud](https://www.elastic.co/cloud) and [https://aws.amazon.com/marketplace/pp/B01N6YCISK](https://aws.amazon.com/marketplace/pp/B01N6YCISK) ?

Cloud by elastic is one way to have access to all features, all managed by us. Think about what is there yet like Security, Monitoring, Reporting, SQL, Canvas, APM, Logs UI, Infra UI and what is coming next 🙂 ...

If you are using Elasticsearch AWS Service, you won't have access to this most likely.

---

<div class="post-metadata">

**Author:** ![winny](https://avatars.discourse-cdn.com/v4/letter/w/53a042/32.png) [@winny](https://discuss.elastic.co/u/winny)\
**Post date:** [February 21, 2019, 12:05pm UTC](https://discuss.elastic.co/t/how-to-automate-the-rollover-index-api-in-aws-elastic-search/169401/3 "2019-02-21T12:05:00Z")

</div>

Unfortunetly I use ElasticSearch 6.2 on AWS 😓 Is there any other way to achieve this?

---

<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:** [February 21, 2019, 12:24pm UTC](https://discuss.elastic.co/t/how-to-automate-the-rollover-index-api-in-aws-elastic-search/169401/4 "2019-02-21T12:24:13Z")

</div>

You can probably use Curator and call it from a crontab ?  
So start a EC2 instance with this crontab or may be a lambda can do this?

---

<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:** [February 21, 2019, 1:08pm UTC](https://discuss.elastic.co/t/how-to-automate-the-rollover-index-api-in-aws-elastic-search/169401/6 "2019-02-21T13:08:19Z")

</div>

I don't. Sorry.

Again you should really consider [cloud.elastic.co](http://cloud.elastic.co). It runs on AWS or GCP. So practically it should be easy to switch to it.

---

<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:** [March 21, 2019, 1:08pm UTC](https://discuss.elastic.co/t/how-to-automate-the-rollover-index-api-in-aws-elastic-search/169401/7 "2019-03-21T13:08:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
