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

****************
delete_key_group
****************



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

  

  Deletes a key group.

   

  You cannot delete a key group that is referenced in a cache behavior. First update your distributions to remove the key group from all cache behaviors, then delete the key group.

   

  To delete a key group, you must provide the key group's identifier and version. To get these values, use ``ListKeyGroups`` followed by ``GetKeyGroup`` or ``GetKeyGroupConfig``.

  

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


  **Request Syntax**
  ::

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

    The identifier of the key group that you are deleting. To get the identifier, use ``ListKeyGroups``.

    

  
  :type IfMatch: string
  :param IfMatch: 

    The version of the key group that you are deleting. The version is the key group's ``ETag`` value. To get the ``ETag``, use ``GetKeyGroup`` or ``GetKeyGroupConfig``.

    

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

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

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

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

  