Search code examples
pythonamazon-web-servicesboto3amazon-elasticache

How to remove aws elasticache redis type cluster using boto3?


I want to remove an aws elasticache redis cluster using boto3.

The syntax I was expecting to work was:

response = client.delete_cache_cluster(
    CacheClusterId='string'
)

But it does not work. In fact, the documentation states:

This operation is not valid for:

  • Redis (cluster mode enabled) clusters

I'm not able to find how can I delete the redis cluster...


Solution

  • There is a Redis only command, delete_replication_group. See This.


    Once you find the doc. for create_replication_group, then it says

    Creates a Redis (cluster mode disabled) or a Redis (cluster mode enabled) replication group.

    and for delete_replication_group,

    Deletes an existing replication group. By default, this operation deletes the entire replication group, including the primary/primaries and all of the read replicas. If the replication group has only one primary, you can optionally delete only the read replicas, while retaining the primary by setting RetainPrimaryCluster=true .