ConfigService.Client.
describe_compliance_by_resource
(**kwargs)¶Indicates whether the specified Amazon Web Services resources are compliant. If a resource is noncompliant, this action returns the number of Config rules that the resource does not comply with.
A resource is compliant if it complies with all the Config rules that evaluate it. It is noncompliant if it does not comply with one or more of these rules.
If Config has no current evaluation results for the resource, it returns INSUFFICIENT_DATA
. This result might indicate one of the following conditions about the rules that evaluate the resource:
DescribeConfigRuleEvaluationStatus
action to get the LastSuccessfulInvocationTime
and LastFailedInvocationTime
.config:PutEvaluations
permission. If the rule is a custom rule, verify that the Lambda execution role includes the config:PutEvaluations
permission.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
Request Syntax
response = client.describe_compliance_by_resource(
ResourceType='string',
ResourceId='string',
ComplianceTypes=[
'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
],
Limit=123,
NextToken='string'
)
AWS::EC2::Instance
). For this action, you can specify that the resource type is an Amazon Web Services account by specifying AWS::::Account
.ResourceType
.Filters the results by compliance.
nextToken
string returned on a previous page that you use to get the next page of results in a paginated response.dict
Response Syntax
{
'ComplianceByResources': [
{
'ResourceType': 'string',
'ResourceId': 'string',
'Compliance': {
'ComplianceType': 'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
'ComplianceContributorCount': {
'CappedCount': 123,
'CapExceeded': True|False
}
}
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
ComplianceByResources (list) --
Indicates whether the specified Amazon Web Services resource complies with all of the Config rules that evaluate it.
(dict) --
Indicates whether an Amazon Web Services resource that is evaluated according to one or more Config rules is compliant. A resource is compliant if it complies with all of the rules that evaluate it. A resource is noncompliant if it does not comply with one or more of these rules.
ResourceType (string) --
The type of the Amazon Web Services resource that was evaluated.
ResourceId (string) --
The ID of the Amazon Web Services resource that was evaluated.
Compliance (dict) --
Indicates whether the Amazon Web Services resource complies with all of the Config rules that evaluated it.
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
ConfigService.Client.exceptions.InvalidParameterValueException
ConfigService.Client.exceptions.InvalidNextTokenException