:doc:`CloudFront <../../cloudfront>` / Client / delete_cache_policy

*******************
delete_cache_policy
*******************



.. py:method:: CloudFront.Client.delete_cache_policy(**kwargs)

  

  Deletes a cache policy.

   

  You cannot delete a cache policy if it's attached to a cache behavior. First update your distributions to remove the cache policy from all cache behaviors, then delete the cache policy.

   

  To delete a cache policy, you must provide the policy's identifier and version. To get these values, you can use ``ListCachePolicies`` or ``GetCachePolicy``.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2020-05-31/DeleteCachePolicy>`_  


  **Request Syntax**
  ::

    response = client.delete_cache_policy(
        Id='string',
        IfMatch='string'
    )
    
  :type Id: string
  :param Id: **[REQUIRED]** 

    The unique identifier for the cache policy that you are deleting. To get the identifier, you can use ``ListCachePolicies``.

    

  
  :type IfMatch: string
  :param IfMatch: 

    The version of the cache policy that you are deleting. The version is the cache policy's ``ETag`` value, which you can get using ``ListCachePolicies``, ``GetCachePolicy``, or ``GetCachePolicyConfig``.

    

  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`CloudFront.Client.exceptions.NoSuchCachePolicy`

  
  *   :py:class:`CloudFront.Client.exceptions.PreconditionFailed`

  
  *   :py:class:`CloudFront.Client.exceptions.AccessDenied`

  
  *   :py:class:`CloudFront.Client.exceptions.IllegalDelete`

  
  *   :py:class:`CloudFront.Client.exceptions.CachePolicyInUse`

  
  *   :py:class:`CloudFront.Client.exceptions.InvalidIfMatchVersion`

  