🎯 Objectives
- Delete old data on ES indices using Curator
Prerequisite
- An AWS account
- An Opensearch hosted application
- Create an
IAM
user specifically for this purpose and copyaws
access and secret-keys.
Delete Old Indices on AWS OpenSearch
- Click
Identity and Access Management (IAM)
->Users
->Add Users
-><specify-username>
->Click Access key - Programmatic access
->Attach existing policies directly
->AmazonOpenSearchServiceFullAccess
To avoid the following error below
1 | no permissions for [cluster:monitor/main] and User [name=arn:aws:iam::<AWS_ACCOUNT_ID>:user/<specify-username>, backend_roles=[], requestedTenant=null] |
- Login to Kibana UI,
Click Security
-> Roles
-> all_access
-> Mapped users
-> Manage Mapping
, then add your IAM user ARN, to internal user mapping
-> Map
- Create a virtual enviroment and Install Curator
1 | python3 -m venv env |
- Create a curator configuration file
1 | touch curator.yaml |
Add the following content below to your curator.yaml
file.
1 |
|
If you want to add more environment configurations, here is the official documentation
- Create an action file for deleting indices
Actions are the tasks which Curator can perform on your indices.
1 | touch delete_indices.yaml |
1 |
|
If you want to add more environment configurations, here is the official documentation
- Run curator
The command-line arguments are as follows:
1 | curator [--config CONFIG.YML] [--dry-run] ACTION_FILE.YML |
Note
If --dry-run
flag is included, Curator will simulate the action(s) in delete_indices.yaml
as closely as possible without actually making any changes. The results will be in the logfile info.log
or STDOUT/command-line if no logfile is specified.
Run the following command
1 | curator -config curator.yaml delete_indices.yaml |
References