项目作者: davidh83110

项目描述 :
Automatically delete older indices on AWS Elasticsearch.
高级语言: Python
项目地址: git://github.com/davidh83110/lambda-elasticsearch-index-rotation.git
创建时间: 2020-08-27T03:35:59Z
项目社区:https://github.com/davidh83110/lambda-elasticsearch-index-rotation

开源协议:MIT License

下载


lambda-elasticsearch-index-rotation

Automatically delete older indics on AWS Elasticsearch.

Environment

  • Python 3
  • Lambda function and execution role
  • Make sure the Lambda role has been added in AWS Elasticsearch’s allow list on the access policy
  • Cloudwatch Event Rule

Build

  1. $ pip install -r requirements.txt -t ./
  2. $ zip -r artifact.zip ./*

Parameters (Configure on Cloudwatch Event)

  • endpoint (string)
    • The endpoint of AWS Elasticsearch with “https://“ and without “/“ on the suffix.
  • region (string)
    • The region of AWS Elasticsearch.
  • older_than (int)
    • The rotation days of index.
  • exclude (list)
    • The keyword contains in index names which will not be deleted.

Example

  1. {
  2. "endpoint":"https://search-test-es-wrr22fsafafwe2.ap-northeast-1.es.amazonaws.com",
  3. "region": "ap-northeast-1",
  4. "older_than": "1",
  5. "exclude": ["testapi", "testaudit"]
  6. },
  7. {
  8. "endpoint":"https://searchwewqewqewqewqewqefwe2.ap-northeast-1.es.amazonaws.com",
  9. "region": "us-west-1",
  10. "older_than": "1",
  11. "exclude": [""]
  12. }

TODO

  • Terraform