Error creating State Management Policies

I created the following policy that will transition from hot to cold for all indices each day

{
    "id": "hot_to_cold_policy",
    "seqNo": 27868,
    "primaryTerm": 11,
    "policy": {
        "policy_id": "hot_to_cold_policy",
        "description": "Hot to cold transition, snapshot, and delete local index",
        "last_updated_time": 1696262321299,
        "schema_version": 18,
        "error_notification": null,
        "default_state": "hot",
        "states": [
            {
                "name": "hot",
                "actions": [],
                "transitions": [
                    {
                        "state_name": "cold",
                        "conditions": {
                            "min_index_age": "1d"
                        }
                    }
                ]
            },
            {
                "name": "cold",
                "actions": [
                    {
                        "retry": {
                            "count": 3,
                            "backoff": "exponential",
                            "delay": "1m"
                        },
                        "snapshot": {
                            "repository": "/opensearch_coldstorage/",
                            "snapshot": "{{ctx.index}}_snapshot"
                        }
                    },
                    {
                        "retry": {
                            "count": 3,
                            "backoff": "exponential",
                            "delay": "1m"
                        },
                        "delete": {}
                    }
                ],
                "transitions": []
            }
        ],
        "ism_template": [
            {
                "index_patterns": [
                    "*"
                ],
                "priority": 100,
                "last_updated_time": 1696262258189
            }
        ]
    }
}

My repository is a mounted s3 bucket which has full r/w access for the opensearch user BUT Iā€™m receiving the following error

{
    "cause": "[/opensearch_coldstorage] missing",
    "message": "Failed to create snapshot [index=xxxx-2023.09.28]"
}

I can manually issue the PUT /_snapshot/ColdStorage/1 command without any issues. Not sure why automatic task is failing.

Wild shot: if your repository name is ColdStorage, does it work with:

"repository": "ColdStorage",

You are correct. Thank you

1 Like