:doc:`ConfigService <../../config>` / Client / describe_compliance_by_config_rule

**********************************
describe_compliance_by_config_rule
**********************************



.. py:method:: ConfigService.Client.describe_compliance_by_config_rule(**kwargs)

  

  Indicates whether the specified Config rules are compliant. If a rule is noncompliant, this operation returns the number of Amazon Web Services resources that do not comply with the rule.

   

  A rule is compliant if all of the evaluated resources comply with it. It is noncompliant if any of these resources do not comply.

   

  If Config has no current evaluation results for the rule, it returns ``INSUFFICIENT_DATA``. This result might indicate one of the following conditions:

   

  
  * Config has never invoked an evaluation for the rule. To check whether it has, use the ``DescribeConfigRuleEvaluationStatus`` action to get the ``LastSuccessfulInvocationTime`` and ``LastFailedInvocationTime``.
   
  * The rule's Lambda function is failing to send evaluation results to Config. Verify that the role you assigned to your configuration recorder includes the ``config:PutEvaluations`` permission. If the rule is a custom rule, verify that the Lambda execution role includes the ``config:PutEvaluations`` permission.
   
  * The rule's Lambda function has returned ``NOT_APPLICABLE`` for all evaluation results. This can occur if the resources were deleted or removed from the rule's scope.
  

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/DescribeComplianceByConfigRule>`_  


  **Request Syntax**
  ::

    response = client.describe_compliance_by_config_rule(
        ConfigRuleNames=[
            'string',
        ],
        ComplianceTypes=[
            'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
        ],
        NextToken='string'
    )
    
  :type ConfigRuleNames: list
  :param ConfigRuleNames: 

    Specify one or more Config rule names to filter the results by rule.

    

  
    - *(string) --* 

    

  :type ComplianceTypes: list
  :param ComplianceTypes: 

    Filters the results by compliance.

    

  
    - *(string) --* 

    

  :type NextToken: string
  :param NextToken: 

    The ``nextToken`` string returned on a previous page that you use to get the next page of results in a paginated response.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'ComplianceByConfigRules': [
              {
                  'ConfigRuleName': 'string',
                  'Compliance': {
                      'ComplianceType': 'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
                      'ComplianceContributorCount': {
                          'CappedCount': 123,
                          'CapExceeded': True|False
                      }
                  }
              },
          ],
          'NextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **ComplianceByConfigRules** *(list) --* 

        Indicates whether each of the specified Config rules is compliant.

        
        

        - *(dict) --* 

          Indicates whether an Config rule is compliant. A rule is compliant if all of the resources that the rule evaluated comply with it. A rule is noncompliant if any of these resources do not comply.

          
          

          - **ConfigRuleName** *(string) --* 

            The name of the Config rule.

            
          

          - **Compliance** *(dict) --* 

            Indicates whether the Config rule is compliant.

            
            

            - **ComplianceType** *(string) --* 

              Indicates whether an Amazon Web Services resource or Config rule is compliant.

               

              A resource is compliant if it complies with all of the Config rules that evaluate it. A resource is noncompliant if it does not comply with one or more of these rules.

               

              A rule is compliant if all of the resources that the rule evaluates comply with it. A rule is noncompliant if any of these resources do not comply.

               

              Config returns the ``INSUFFICIENT_DATA`` value when no evaluation results are available for the Amazon Web Services resource or Config rule.

               

              For the ``Compliance`` data type, Config supports only ``COMPLIANT``, ``NON_COMPLIANT``, and ``INSUFFICIENT_DATA`` values. Config does not support the ``NOT_APPLICABLE`` value for the ``Compliance`` data type.

              
            

            - **ComplianceContributorCount** *(dict) --* 

              The number of Amazon Web Services resources or Config rules that cause a result of ``NON_COMPLIANT``, up to a maximum number.

              
              

              - **CappedCount** *(integer) --* 

                The number of Amazon Web Services resources or Config rules responsible for the current compliance of the item.

                
              

              - **CapExceeded** *(boolean) --* 

                Indicates whether the maximum count is reached.

                
          
        
      
    
      

      - **NextToken** *(string) --* 

        The string that you use in a subsequent request to get the next page of results in a paginated response.

        
  
  **Exceptions**
  
  *   :py:class:`ConfigService.Client.exceptions.InvalidParameterValueException`

  
  *   :py:class:`ConfigService.Client.exceptions.NoSuchConfigRuleException`

  
  *   :py:class:`ConfigService.Client.exceptions.InvalidNextTokenException`

  