Skip to content

delete_cache_cluster async

delete_cache_cluster(
    *,
    config_overrides: Optional[AsyncElastiCacheClientConfig] = None,
    cache_cluster_id: Optional[String] = None,
    final_snapshot_identifier: Optional[String] = None,
) -> DeleteCacheClusterResult

Deletes a previously provisioned cluster. DeleteCacheCluster deletes all associated cache nodes, node endpoints and the cluster itself. When you receive a successful response from this operation, Amazon ElastiCache immediately begins deleting the cluster; you cannot cancel or revert this operation.

This operation is not valid for:

  • Valkey or Redis OSS (cluster mode enabled) clusters

  • Valkey or Redis OSS (cluster mode disabled) clusters

  • A cluster that is the last read replica of a replication group

  • A cluster that is the primary node of a replication group

  • A node group (shard) that has Multi-AZ mode enabled

  • A cluster from a Valkey or Redis OSS (cluster mode enabled) replication group

  • A cluster that is not in the available state

Parameters:

  • cache_cluster_id (Optional[String], default: None ) –

    The cluster identifier for the cluster to be deleted. This parameter is not case sensitive.

  • final_snapshot_identifier (Optional[String], default: None ) –

    The user-supplied name of a final cluster snapshot. This is the unique name that identifies the snapshot. ElastiCache creates the snapshot, and then deletes the cluster immediately afterward.

Raises:

Examples:

DeleteCacheCluster Deletes an Amazon ElastiCache cluster.

>>> await client.delete_cache_cluster(cache_cluster_id='my-memcached')
Source code in docs_src/capo_elasticache/_services/async_elasti_cache.py
async def delete_cache_cluster(
    self,
    *,
    config_overrides: Optional[AsyncElastiCacheClientConfig] = None,
    cache_cluster_id: Optional["capo_elasticache.types.string.String"] = None,
    final_snapshot_identifier: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
) -> "capo_elasticache.types.delete_cache_cluster_result.DeleteCacheClusterResult":
    """<p>Deletes a previously provisioned cluster. <code>DeleteCacheCluster</code> deletes all associated cache nodes, node endpoints and the cluster itself. When you receive a successful response from this operation, Amazon ElastiCache immediately begins deleting the cluster; you cannot cancel or revert this operation.</p> <p>This operation is not valid for:</p> <ul> <li> <p>Valkey or Redis OSS (cluster mode enabled) clusters</p> </li> <li> <p>Valkey or Redis OSS (cluster mode disabled) clusters</p> </li> <li> <p>A cluster that is the last read replica of a replication group</p> </li> <li> <p>A cluster that is the primary node of a replication group</p> </li> <li> <p>A node group (shard) that has Multi-AZ mode enabled</p> </li> <li> <p>A cluster from a Valkey or Redis OSS (cluster mode enabled) replication group</p> </li> <li> <p>A cluster that is not in the <code>available</code> state</p> </li> </ul>

    Args:
        cache_cluster_id: <p>The cluster identifier for the cluster to be deleted. This parameter is not case sensitive.</p>
        final_snapshot_identifier: <p>The user-supplied name of a final cluster snapshot. This is the unique name that identifies the snapshot. ElastiCache creates the snapshot, and then deletes the cluster immediately afterward.</p>

    Raises:
        capo_elasticache.errors.cache_cluster_not_found_fault.CacheClusterNotFoundFault: <p>The requested cluster ID does not refer to an existing cluster.</p>
        capo_elasticache.errors.invalid_cache_cluster_state_fault.InvalidCacheClusterStateFault: <p>The requested cluster is not in the <code>available</code> state.</p>
        capo_elasticache.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Two or more incompatible parameters were specified.</p>
        capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
        capo_elasticache.errors.snapshot_already_exists_fault.SnapshotAlreadyExistsFault: <p>You already have a snapshot with the given name.</p>
        capo_elasticache.errors.snapshot_feature_not_supported_fault.SnapshotFeatureNotSupportedFault: <p>You attempted one of the following operations:</p> <ul> <li> <p>Creating a snapshot of a Valkey or Redis OSS cluster running on a <code>cache.t1.micro</code> cache node.</p> </li> <li> <p>Creating a snapshot of a cluster that is running Memcached rather than Valkey or Redis OSS.</p> </li> </ul> <p>Neither of these are supported by ElastiCache.</p>
        capo_elasticache.errors.snapshot_quota_exceeded_fault.SnapshotQuotaExceededFault: <p>The request cannot be processed because it would exceed the maximum number of snapshots.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        DeleteCacheCluster
        Deletes an Amazon ElastiCache cluster.

        >>> await client.delete_cache_cluster(cache_cluster_id='my-memcached')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_elasticache.types.delete_cache_cluster_message.DeleteCacheClusterMessage]",
    ) -> AsyncOperationResponse[
        "capo_elasticache.types.delete_cache_cluster_result.DeleteCacheClusterResult"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.delete_cache_cluster

        (
            output,
            http_response,
        ) = await capo_elasticache._operations.amazon_elasti_cache_v9.delete_cache_cluster.async_delete_cache_cluster(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteCacheCluster")
    )
    input_: capo_elasticache.types.delete_cache_cluster_message.DeleteCacheClusterMessage = {}
    if cache_cluster_id is not None:
        input_["cache_cluster_id"] = cache_cluster_id
    if final_snapshot_identifier is not None:
        input_["final_snapshot_identifier"] = final_snapshot_identifier

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output