AWS Config

2022/11/29 - AWS Config - 3 new 6 updated api methods

Changes  With this release, you can use AWS Config to evaluate your resources for compliance with Config rules before they are created or updated. Using Config rules in proactive mode enables you to test and build compliant resource templates or check resource configurations at the time they are provisioned.

StartResourceEvaluation (new) Link ¶

Runs an on-demand evaluation for the specified resource to determine whether the resource details will comply with configured Config rules. You can also use it for evaluation purposes. Config recommends using an evaluation context. It runs an execution against the resource details with all of the Config rules in your account that match with the specified proactive mode and resource type.

Note

Ensure you have the cloudformation:DescribeType role setup to validate the resource type schema.

See also: AWS API Documentation

Request Syntax

client.start_resource_evaluation(
    ResourceDetails={
        'ResourceId': 'string',
        'ResourceType': 'string',
        'ResourceConfiguration': 'string',
        'ResourceConfigurationSchemaType': 'CFN_RESOURCE_SCHEMA'
    },
    EvaluationContext={
        'EvaluationContextIdentifier': 'string'
    },
    EvaluationMode='DETECTIVE'|'PROACTIVE',
    EvaluationTimeout=123,
    ClientToken='string'
)
type ResourceDetails

dict

param ResourceDetails

[REQUIRED]

Returns a ResourceDetails object.

  • ResourceId (string) -- [REQUIRED]

    A unique resource ID for an evaluation.

  • ResourceType (string) -- [REQUIRED]

    The type of resource being evaluated.

  • ResourceConfiguration (string) -- [REQUIRED]

    The resource definition to be evaluated as per the resource configuration schema type.

  • ResourceConfigurationSchemaType (string) --

    The schema type of the resource configuration.

type EvaluationContext

dict

param EvaluationContext

Returns an EvaluationContext object.

  • EvaluationContextIdentifier (string) --

    A unique EvaluationContextIdentifier ID for an EvaluationContext.

type EvaluationMode

string

param EvaluationMode

[REQUIRED]

The mode of an evaluation. The valid value for this API is Proactive .

type EvaluationTimeout

integer

param EvaluationTimeout

The timeout for an evaluation. The default is 900 seconds. You cannot specify a number greater than 3600. If you specify 0, Config uses the default.

type ClientToken

string

param ClientToken

A client token is a unique, case-sensitive string of up to 64 ASCII characters. To make an idempotent API request using one of these actions, specify a client token in the request.

Note

Avoid reusing the same client token for other API requests. If you retry a request that completed successfully using the same client token and the same parameters, the retry succeeds without performing any further actions. If you retry a successful request using the same client token, but one or more of the parameters are different, other than the Region or Availability Zone, the retry fails with an IdempotentParameterMismatch error.

rtype

dict

returns

Response Syntax

{
    'ResourceEvaluationId': 'string'
}

Response Structure

  • (dict) --

    • ResourceEvaluationId (string) --

      A unique ResourceEvaluationId that is associated with a single execution.

ListResourceEvaluations (new) Link ¶

Returns a list of proactive resource evaluations.

See also: AWS API Documentation

Request Syntax

client.list_resource_evaluations(
    Filters={
        'EvaluationMode': 'DETECTIVE'|'PROACTIVE',
        'TimeWindow': {
            'StartTime': datetime(2015, 1, 1),
            'EndTime': datetime(2015, 1, 1)
        },
        'EvaluationContextIdentifier': 'string'
    },
    Limit=123,
    NextToken='string'
)
type Filters

dict

param Filters

Returns a ResourceEvaluationFilters object.

  • EvaluationMode (string) --

    Filters all resource evaluations results based on an evaluation mode. the valid value for this API is Proactive .

  • TimeWindow (dict) --

    Returns a TimeWindow object.

    • StartTime (datetime) --

      The start time of an execution.

    • EndTime (datetime) --

      The end time of an execution. The end time must be after the start date.

  • EvaluationContextIdentifier (string) --

    Filters evaluations for a given infrastructure deployment. For example: CFN Stack.

type Limit

integer

param Limit

The maximum number of evaluations returned on each page. The default is 10. You cannot specify a number greater than 100. If you specify 0, Config uses the default.

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

{
    'ResourceEvaluations': [
        {
            'ResourceEvaluationId': 'string',
            'EvaluationMode': 'DETECTIVE'|'PROACTIVE',
            'EvaluationStartTimestamp': datetime(2015, 1, 1)
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • ResourceEvaluations (list) --

      Returns a ResourceEvaluations object.

      • (dict) --

        Returns details of a resource evaluation.

        • ResourceEvaluationId (string) --

          The ResourceEvaluationId of a evaluation.

        • EvaluationMode (string) --

          The mode of an evaluation. The valid values are Detective or Proactive.

        • EvaluationStartTimestamp (datetime) --

          The starting time of an execution.

    • NextToken (string) --

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

GetResourceEvaluationSummary (new) Link ¶

Returns a summary of resource evaluation for the specified resource evaluation ID from the proactive rules that were run. The results indicate which evaluation context was used to evaluate the rules, which resource details were evaluated, the evaluation mode that was run, and whether the resource details comply with the configuration of the proactive rules.

See also: AWS API Documentation

Request Syntax

client.get_resource_evaluation_summary(
    ResourceEvaluationId='string'
)
type ResourceEvaluationId

string

param ResourceEvaluationId

[REQUIRED]

The unique ResourceEvaluationId of Amazon Web Services resource execution for which you want to retrieve the evaluation summary.

rtype

dict

returns

Response Syntax

{
    'ResourceEvaluationId': 'string',
    'EvaluationMode': 'DETECTIVE'|'PROACTIVE',
    'EvaluationStatus': {
        'Status': 'IN_PROGRESS'|'FAILED'|'SUCCEEDED',
        'FailureReason': 'string'
    },
    'EvaluationStartTimestamp': datetime(2015, 1, 1),
    'Compliance': 'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
    'EvaluationContext': {
        'EvaluationContextIdentifier': 'string'
    },
    'ResourceDetails': {
        'ResourceId': 'string',
        'ResourceType': 'string',
        'ResourceConfiguration': 'string',
        'ResourceConfigurationSchemaType': 'CFN_RESOURCE_SCHEMA'
    }
}

Response Structure

  • (dict) --

    • ResourceEvaluationId (string) --

      The unique ResourceEvaluationId of Amazon Web Services resource execution for which you want to retrieve the evaluation summary.

    • EvaluationMode (string) --

      Lists results of the mode that you requested to retrieve the resource evaluation summary. The valid values are Detective or Proactive.

    • EvaluationStatus (dict) --

      Returns an EvaluationStatus object.

      • Status (string) --

        The status of an execution. The valid values are In_Progress, Succeeded or Failed.

      • FailureReason (string) --

        An explanation for failed execution status.

    • EvaluationStartTimestamp (datetime) --

      The start timestamp when Config rule starts evaluating compliance for the provided resource details.

    • Compliance (string) --

      The compliance status of the resource evaluation summary.

    • EvaluationContext (dict) --

      Returns an EvaluationContext object.

      • EvaluationContextIdentifier (string) --

        A unique EvaluationContextIdentifier ID for an EvaluationContext.

    • ResourceDetails (dict) --

      Returns a ResourceDetails object.

      • ResourceId (string) --

        A unique resource ID for an evaluation.

      • ResourceType (string) --

        The type of resource being evaluated.

      • ResourceConfiguration (string) --

        The resource definition to be evaluated as per the resource configuration schema type.

      • ResourceConfigurationSchemaType (string) --

        The schema type of the resource configuration.

DescribeConfigRules (updated) Link ¶
Changes (request, response)
Request
{'Filters': {'EvaluationMode': 'DETECTIVE | PROACTIVE'}}
Response
{'ConfigRules': {'EvaluationModes': [{'Mode': 'DETECTIVE | PROACTIVE'}]}}

Returns details about your Config rules.

See also: AWS API Documentation

Request Syntax

client.describe_config_rules(
    ConfigRuleNames=[
        'string',
    ],
    NextToken='string',
    Filters={
        'EvaluationMode': 'DETECTIVE'|'PROACTIVE'
    }
)
type ConfigRuleNames

list

param ConfigRuleNames

The names of the Config rules for which you want details. If you do not specify any names, Config returns details for all your rules.

  • (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.

type Filters

dict

param Filters

Returns a list of Detecive or Proactive Config rules. By default, this API returns an unfiltered list.

  • EvaluationMode (string) --

    The mode of an evaluation. The valid values are Detective or Proactive.

rtype

dict

returns

Response Syntax

{
    'ConfigRules': [
        {
            'ConfigRuleName': 'string',
            'ConfigRuleArn': 'string',
            'ConfigRuleId': 'string',
            'Description': 'string',
            'Scope': {
                'ComplianceResourceTypes': [
                    'string',
                ],
                'TagKey': 'string',
                'TagValue': 'string',
                'ComplianceResourceId': 'string'
            },
            'Source': {
                'Owner': 'CUSTOM_LAMBDA'|'AWS'|'CUSTOM_POLICY',
                'SourceIdentifier': 'string',
                'SourceDetails': [
                    {
                        'EventSource': 'aws.config',
                        'MessageType': 'ConfigurationItemChangeNotification'|'ConfigurationSnapshotDeliveryCompleted'|'ScheduledNotification'|'OversizedConfigurationItemChangeNotification',
                        'MaximumExecutionFrequency': 'One_Hour'|'Three_Hours'|'Six_Hours'|'Twelve_Hours'|'TwentyFour_Hours'
                    },
                ],
                'CustomPolicyDetails': {
                    'PolicyRuntime': 'string',
                    'PolicyText': 'string',
                    'EnableDebugLogDelivery': True|False
                }
            },
            'InputParameters': 'string',
            'MaximumExecutionFrequency': 'One_Hour'|'Three_Hours'|'Six_Hours'|'Twelve_Hours'|'TwentyFour_Hours',
            'ConfigRuleState': 'ACTIVE'|'DELETING'|'DELETING_RESULTS'|'EVALUATING',
            'CreatedBy': 'string',
            'EvaluationModes': [
                {
                    'Mode': 'DETECTIVE'|'PROACTIVE'
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • ConfigRules (list) --

      The details about your Config rules.

      • (dict) --

        Config rules evaluate the configuration settings of your Amazon Web Services resources. A rule can run when Config detects a configuration change to an Amazon Web Services resource or at a periodic frequency that you choose (for example, every 24 hours). There are two types of rules: Config Managed Rules and Config Custom Rules. Managed rules are predefined, customizable rules created by Config. For a list of managed rules, see List of Config Managed Rules.

        Custom rules are rules that you can create using either Guard or Lambda functions. Guard ( Guard GitHub Repository ) is a policy-as-code language that allows you to write policies that are enforced by Config Custom Policy rules. Lambda uses custom code that you upload to evaluate a custom rule. It is invoked by events that are published to it by an event source, which Config invokes when the custom rule is initiated.

        For more information about developing and using Config rules, see Evaluating Amazon Web Services resource Configurations with Config in the Config Developer Guide .

        Note

        You can use the Amazon Web Services CLI and Amazon Web Services SDKs if you want to create a rule that triggers evaluations for your resources when Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.

        • ConfigRuleName (string) --

          The name that you assign to the Config rule. The name is required if you are adding a new rule.

        • ConfigRuleArn (string) --

          The Amazon Resource Name (ARN) of the Config rule.

        • ConfigRuleId (string) --

          The ID of the Config rule.

        • Description (string) --

          The description that you provide for the Config rule.

        • Scope (dict) --

          Defines which resources can trigger an evaluation for the rule. The scope can include one or more resource types, a combination of one resource type and one resource ID, or a combination of a tag key and value. Specify a scope to constrain the resources that can trigger an evaluation for the rule. If you do not specify a scope, evaluations are triggered when any resource in the recording group changes.

          Note

          The scope can be empty.

          • ComplianceResourceTypes (list) --

            The resource types of only those Amazon Web Services resources that you want to trigger an evaluation for the rule. You can only specify one type if you also specify a resource ID for ComplianceResourceId .

            • (string) --

          • TagKey (string) --

            The tag key that is applied to only those Amazon Web Services resources that you want to trigger an evaluation for the rule.

          • TagValue (string) --

            The tag value applied to only those Amazon Web Services resources that you want to trigger an evaluation for the rule. If you specify a value for TagValue , you must also specify a value for TagKey .

          • ComplianceResourceId (string) --

            The ID of the only Amazon Web Services resource that you want to trigger an evaluation for the rule. If you specify a resource ID, you must specify one resource type for ComplianceResourceTypes .

        • Source (dict) --

          Provides the rule owner ( Amazon Web Services for managed rules, CUSTOM_POLICY for Custom Policy rules, and CUSTOM_LAMBDA for Custom Lambda rules), the rule identifier, and the notifications that cause the function to evaluate your Amazon Web Services resources.

          • Owner (string) --

            Indicates whether Amazon Web Services or the customer owns and manages the Config rule.

            Config Managed Rules are predefined rules owned by Amazon Web Services. For more information, see Config Managed Rules in the Config developer guide .

            Config Custom Rules are rules that you can develop either with Guard ( CUSTOM_POLICY ) or Lambda ( CUSTOM_LAMBDA ). For more information, see Config Custom Rules in the Config developer guide .

          • SourceIdentifier (string) --

            For Config Managed rules, a predefined identifier from a list. For example, IAM_PASSWORD_POLICY is a managed rule. To reference a managed rule, see List of Config Managed Rules.

            For Config Custom Lambda rules, the identifier is the Amazon Resource Name (ARN) of the rule's Lambda function, such as arn:aws:lambda:us-east-2:123456789012:function:custom_rule_name .

            For Config Custom Policy rules, this field will be ignored.

          • SourceDetails (list) --

            Provides the source and the message types that cause Config to evaluate your Amazon Web Services resources against a rule. It also provides the frequency with which you want Config to run evaluations for the rule if the trigger type is periodic.

            If the owner is set to CUSTOM_POLICY , the only acceptable values for the Config rule trigger message type are ConfigurationItemChangeNotification and OversizedConfigurationItemChangeNotification .

            • (dict) --

              Provides the source and the message types that trigger Config to evaluate your Amazon Web Services resources against a rule. It also provides the frequency with which you want Config to run evaluations for the rule if the trigger type is periodic. You can specify the parameter values for SourceDetail only for custom rules.

              • EventSource (string) --

                The source of the event, such as an Amazon Web Services service, that triggers Config to evaluate your Amazon Web Services resources.

              • MessageType (string) --

                The type of notification that triggers Config to run an evaluation for a rule. You can specify the following notification types:

                • ConfigurationItemChangeNotification - Triggers an evaluation when Config delivers a configuration item as a result of a resource change.

                • OversizedConfigurationItemChangeNotification - Triggers an evaluation when Config delivers an oversized configuration item. Config may generate this notification type when a resource changes and the notification exceeds the maximum size allowed by Amazon SNS.

                • ScheduledNotification - Triggers a periodic evaluation at the frequency specified for MaximumExecutionFrequency .

                • ConfigurationSnapshotDeliveryCompleted - Triggers a periodic evaluation when Config delivers a configuration snapshot.

                If you want your custom rule to be triggered by configuration changes, specify two SourceDetail objects, one for ConfigurationItemChangeNotification and one for OversizedConfigurationItemChangeNotification .

              • MaximumExecutionFrequency (string) --

                The frequency at which you want Config to run evaluations for a custom rule with a periodic trigger. If you specify a value for MaximumExecutionFrequency , then MessageType must use the ScheduledNotification value.

                Note

                By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

                Based on the valid value you choose, Config runs evaluations once for each valid value. For example, if you choose Three_Hours , Config runs evaluations once every three hours. In this case, Three_Hours is the frequency of this rule.

          • CustomPolicyDetails (dict) --

            Provides the runtime system, policy definition, and whether debug logging is enabled. Required when owner is set to CUSTOM_POLICY .

            • PolicyRuntime (string) --

              The runtime system for your Config Custom Policy rule. Guard is a policy-as-code language that allows you to write policies that are enforced by Config Custom Policy rules. For more information about Guard, see the Guard GitHub Repository.

            • PolicyText (string) --

              The policy definition containing the logic for your Config Custom Policy rule.

            • EnableDebugLogDelivery (boolean) --

              The boolean expression for enabling debug logging for your Config Custom Policy rule. The default value is false .

        • InputParameters (string) --

          A string, in JSON format, that is passed to the Config rule Lambda function.

        • MaximumExecutionFrequency (string) --

          The maximum frequency with which Config runs evaluations for a rule. You can specify a value for MaximumExecutionFrequency when:

          • This is for an Config managed rule that is triggered at a periodic frequency.

          • Your custom rule is triggered when Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.

          Note

          By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

        • ConfigRuleState (string) --

          Indicates whether the Config rule is active or is currently being deleted by Config. It can also indicate the evaluation status for the Config rule.

          Config sets the state of the rule to EVALUATING temporarily after you use the StartConfigRulesEvaluation request to evaluate your resources against the Config rule.

          Config sets the state of the rule to DELETING_RESULTS temporarily after you use the DeleteEvaluationResults request to delete the current evaluation results for the Config rule.

          Config temporarily sets the state of a rule to DELETING after you use the DeleteConfigRule request to delete the rule. After Config deletes the rule, the rule and all of its evaluations are erased and are no longer available.

        • CreatedBy (string) --

          Service principal name of the service that created the rule.

          Note

          The field is populated only if the service-linked rule is created by a service. The field is empty if you create your own rule.

        • EvaluationModes (list) --

          The modes the Config rule can be evaluated in. The valid values are distinct objects. By default, the value is Detective evaluation mode only.

          • (dict) --

            The configuration object for Config rule evaluation mode. The Supported valid values are Detective or Proactive.

            • Mode (string) --

              The mode of an evaluation. The valid values are Detective or Proactive.

    • NextToken (string) --

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

GetAggregateComplianceDetailsByConfigRule (updated) Link ¶
Changes (response)
{'AggregateEvaluationResults': {'EvaluationResultIdentifier': {'EvaluationResultQualifier': {'EvaluationMode': 'DETECTIVE '
                                                                                                               '| '
                                                                                                               'PROACTIVE'},
                                                               'ResourceEvaluationId': 'string'}}}

Returns the evaluation results for the specified Config rule for a specific resource in a rule. The results indicate which Amazon Web Services resources were evaluated by the rule, when each resource was last evaluated, and whether each resource complies with the rule.

Note

The results can return an empty result page. But if you have a nextToken , the results are displayed on the next page.

See also: AWS API Documentation

Request Syntax

client.get_aggregate_compliance_details_by_config_rule(
    ConfigurationAggregatorName='string',
    ConfigRuleName='string',
    AccountId='string',
    AwsRegion='string',
    ComplianceType='COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
    Limit=123,
    NextToken='string'
)
type ConfigurationAggregatorName

string

param ConfigurationAggregatorName

[REQUIRED]

The name of the configuration aggregator.

type ConfigRuleName

string

param ConfigRuleName

[REQUIRED]

The name of the Config rule for which you want compliance information.

type AccountId

string

param AccountId

[REQUIRED]

The 12-digit account ID of the source account.

type AwsRegion

string

param AwsRegion

[REQUIRED]

The source region from where the data is aggregated.

type ComplianceType

string

param ComplianceType

The resource compliance status.

Note

For the GetAggregateComplianceDetailsByConfigRuleRequest data type, Config supports only the COMPLIANT and NON_COMPLIANT . Config does not support the NOT_APPLICABLE and INSUFFICIENT_DATA values.

type Limit

integer

param Limit

The maximum number of evaluation results returned on each page. The default is 50. You cannot specify a number greater than 100. If you specify 0, Config uses the default.

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

{
    'AggregateEvaluationResults': [
        {
            'EvaluationResultIdentifier': {
                'EvaluationResultQualifier': {
                    'ConfigRuleName': 'string',
                    'ResourceType': 'string',
                    'ResourceId': 'string',
                    'EvaluationMode': 'DETECTIVE'|'PROACTIVE'
                },
                'OrderingTimestamp': datetime(2015, 1, 1),
                'ResourceEvaluationId': 'string'
            },
            'ComplianceType': 'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
            'ResultRecordedTime': datetime(2015, 1, 1),
            'ConfigRuleInvokedTime': datetime(2015, 1, 1),
            'Annotation': 'string',
            'AccountId': 'string',
            'AwsRegion': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • AggregateEvaluationResults (list) --

      Returns an AggregateEvaluationResults object.

      • (dict) --

        The details of an Config evaluation for an account ID and region in an aggregator. Provides the Amazon Web Services resource that was evaluated, the compliance of the resource, related time stamps, and supplementary information.

        • EvaluationResultIdentifier (dict) --

          Uniquely identifies the evaluation result.

          • EvaluationResultQualifier (dict) --

            Identifies an Config rule used to evaluate an Amazon Web Services resource, and provides the type and ID of the evaluated resource.

            • ConfigRuleName (string) --

              The name of the Config rule that was used in the evaluation.

            • ResourceType (string) --

              The type of Amazon Web Services resource that was evaluated.

            • ResourceId (string) --

              The ID of the evaluated Amazon Web Services resource.

            • EvaluationMode (string) --

              The mode of an evaluation. The valid values are Detective or Proactive.

          • OrderingTimestamp (datetime) --

            The time of the event that triggered the evaluation of your Amazon Web Services resources. The time can indicate when Config delivered a configuration item change notification, or it can indicate when Config delivered the configuration snapshot, depending on which event triggered the evaluation.

          • ResourceEvaluationId (string) --

            A Unique ID for an evaluation result.

        • ComplianceType (string) --

          The resource compliance status.

          For the AggregationEvaluationResult data type, Config supports only the COMPLIANT and NON_COMPLIANT . Config does not support the NOT_APPLICABLE and INSUFFICIENT_DATA value.

        • ResultRecordedTime (datetime) --

          The time when Config recorded the aggregate evaluation result.

        • ConfigRuleInvokedTime (datetime) --

          The time when the Config rule evaluated the Amazon Web Services resource.

        • Annotation (string) --

          Supplementary information about how the agrregate evaluation determined the compliance.

        • AccountId (string) --

          The 12-digit account ID of the source account.

        • AwsRegion (string) --

          The source region from where the data is aggregated.

    • NextToken (string) --

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

GetComplianceDetailsByConfigRule (updated) Link ¶
Changes (response)
{'EvaluationResults': {'EvaluationResultIdentifier': {'EvaluationResultQualifier': {'EvaluationMode': 'DETECTIVE '
                                                                                                      '| '
                                                                                                      'PROACTIVE'},
                                                      'ResourceEvaluationId': 'string'}}}

Returns the evaluation results for the specified Config rule. The results indicate which Amazon Web Services resources were evaluated by the rule, when each resource was last evaluated, and whether each resource complies with the rule.

See also: AWS API Documentation

Request Syntax

client.get_compliance_details_by_config_rule(
    ConfigRuleName='string',
    ComplianceTypes=[
        'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
    ],
    Limit=123,
    NextToken='string'
)
type ConfigRuleName

string

param ConfigRuleName

[REQUIRED]

The name of the Config rule for which you want compliance information.

type ComplianceTypes

list

param ComplianceTypes

Filters the results by compliance.

The allowed values are COMPLIANT , NON_COMPLIANT , and NOT_APPLICABLE .

  • (string) --

type Limit

integer

param Limit

The maximum number of evaluation results returned on each page. The default is 10. You cannot specify a number greater than 100. If you specify 0, Config uses the default.

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

{
    'EvaluationResults': [
        {
            'EvaluationResultIdentifier': {
                'EvaluationResultQualifier': {
                    'ConfigRuleName': 'string',
                    'ResourceType': 'string',
                    'ResourceId': 'string',
                    'EvaluationMode': 'DETECTIVE'|'PROACTIVE'
                },
                'OrderingTimestamp': datetime(2015, 1, 1),
                'ResourceEvaluationId': 'string'
            },
            'ComplianceType': 'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
            'ResultRecordedTime': datetime(2015, 1, 1),
            'ConfigRuleInvokedTime': datetime(2015, 1, 1),
            'Annotation': 'string',
            'ResultToken': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • EvaluationResults (list) --

      Indicates whether the Amazon Web Services resource complies with the specified Config rule.

      • (dict) --

        The details of an Config evaluation. Provides the Amazon Web Services resource that was evaluated, the compliance of the resource, related time stamps, and supplementary information.

        • EvaluationResultIdentifier (dict) --

          Uniquely identifies the evaluation result.

          • EvaluationResultQualifier (dict) --

            Identifies an Config rule used to evaluate an Amazon Web Services resource, and provides the type and ID of the evaluated resource.

            • ConfigRuleName (string) --

              The name of the Config rule that was used in the evaluation.

            • ResourceType (string) --

              The type of Amazon Web Services resource that was evaluated.

            • ResourceId (string) --

              The ID of the evaluated Amazon Web Services resource.

            • EvaluationMode (string) --

              The mode of an evaluation. The valid values are Detective or Proactive.

          • OrderingTimestamp (datetime) --

            The time of the event that triggered the evaluation of your Amazon Web Services resources. The time can indicate when Config delivered a configuration item change notification, or it can indicate when Config delivered the configuration snapshot, depending on which event triggered the evaluation.

          • ResourceEvaluationId (string) --

            A Unique ID for an evaluation result.

        • ComplianceType (string) --

          Indicates whether the Amazon Web Services resource complies with the Config rule that evaluated it.

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

        • ResultRecordedTime (datetime) --

          The time when Config recorded the evaluation result.

        • ConfigRuleInvokedTime (datetime) --

          The time when the Config rule evaluated the Amazon Web Services resource.

        • Annotation (string) --

          Supplementary information about how the evaluation determined the compliance.

        • ResultToken (string) --

          An encrypted token that associates an evaluation with an Config rule. The token identifies the rule, the Amazon Web Services resource being evaluated, and the event that triggered the evaluation.

    • NextToken (string) --

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

GetComplianceDetailsByResource (updated) Link ¶
Changes (request, response)
Request
{'ResourceEvaluationId': 'string'}
Response
{'EvaluationResults': {'EvaluationResultIdentifier': {'EvaluationResultQualifier': {'EvaluationMode': 'DETECTIVE '
                                                                                                      '| '
                                                                                                      'PROACTIVE'},
                                                      'ResourceEvaluationId': 'string'}}}

Returns the evaluation results for the specified Amazon Web Services resource. The results indicate which Config rules were used to evaluate the resource, when each rule was last invoked, and whether the resource complies with each rule.

See also: AWS API Documentation

Request Syntax

client.get_compliance_details_by_resource(
    ResourceType='string',
    ResourceId='string',
    ComplianceTypes=[
        'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
    ],
    NextToken='string',
    ResourceEvaluationId='string'
)
type ResourceType

string

param ResourceType

The type of the Amazon Web Services resource for which you want compliance information.

type ResourceId

string

param ResourceId

The ID of the Amazon Web Services resource for which you want compliance information.

type ComplianceTypes

list

param ComplianceTypes

Filters the results by compliance.

The allowed values are COMPLIANT , NON_COMPLIANT , and NOT_APPLICABLE .

  • (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.

type ResourceEvaluationId

string

param ResourceEvaluationId

The unique ID of Amazon Web Services resource execution for which you want to retrieve evaluation results.

Note

You need to only provide either a ResourceEvaluationID or a ResourceID and ResourceType .

rtype

dict

returns

Response Syntax

{
    'EvaluationResults': [
        {
            'EvaluationResultIdentifier': {
                'EvaluationResultQualifier': {
                    'ConfigRuleName': 'string',
                    'ResourceType': 'string',
                    'ResourceId': 'string',
                    'EvaluationMode': 'DETECTIVE'|'PROACTIVE'
                },
                'OrderingTimestamp': datetime(2015, 1, 1),
                'ResourceEvaluationId': 'string'
            },
            'ComplianceType': 'COMPLIANT'|'NON_COMPLIANT'|'NOT_APPLICABLE'|'INSUFFICIENT_DATA',
            'ResultRecordedTime': datetime(2015, 1, 1),
            'ConfigRuleInvokedTime': datetime(2015, 1, 1),
            'Annotation': 'string',
            'ResultToken': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • EvaluationResults (list) --

      Indicates whether the specified Amazon Web Services resource complies each Config rule.

      • (dict) --

        The details of an Config evaluation. Provides the Amazon Web Services resource that was evaluated, the compliance of the resource, related time stamps, and supplementary information.

        • EvaluationResultIdentifier (dict) --

          Uniquely identifies the evaluation result.

          • EvaluationResultQualifier (dict) --

            Identifies an Config rule used to evaluate an Amazon Web Services resource, and provides the type and ID of the evaluated resource.

            • ConfigRuleName (string) --

              The name of the Config rule that was used in the evaluation.

            • ResourceType (string) --

              The type of Amazon Web Services resource that was evaluated.

            • ResourceId (string) --

              The ID of the evaluated Amazon Web Services resource.

            • EvaluationMode (string) --

              The mode of an evaluation. The valid values are Detective or Proactive.

          • OrderingTimestamp (datetime) --

            The time of the event that triggered the evaluation of your Amazon Web Services resources. The time can indicate when Config delivered a configuration item change notification, or it can indicate when Config delivered the configuration snapshot, depending on which event triggered the evaluation.

          • ResourceEvaluationId (string) --

            A Unique ID for an evaluation result.

        • ComplianceType (string) --

          Indicates whether the Amazon Web Services resource complies with the Config rule that evaluated it.

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

        • ResultRecordedTime (datetime) --

          The time when Config recorded the evaluation result.

        • ConfigRuleInvokedTime (datetime) --

          The time when the Config rule evaluated the Amazon Web Services resource.

        • Annotation (string) --

          Supplementary information about how the evaluation determined the compliance.

        • ResultToken (string) --

          An encrypted token that associates an evaluation with an Config rule. The token identifies the rule, the Amazon Web Services resource being evaluated, and the event that triggered the evaluation.

    • NextToken (string) --

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

GetConformancePackComplianceDetails (updated) Link ¶
Changes (response)
{'ConformancePackRuleEvaluationResults': {'EvaluationResultIdentifier': {'EvaluationResultQualifier': {'EvaluationMode': 'DETECTIVE '
                                                                                                                         '| '
                                                                                                                         'PROACTIVE'},
                                                                         'ResourceEvaluationId': 'string'}}}

Returns compliance details of a conformance pack for all Amazon Web Services resources that are monitered by conformance pack.

See also: AWS API Documentation

Request Syntax

client.get_conformance_pack_compliance_details(
    ConformancePackName='string',
    Filters={
        'ConfigRuleNames': [
            'string',
        ],
        'ComplianceType': 'COMPLIANT'|'NON_COMPLIANT'|'INSUFFICIENT_DATA',
        'ResourceType': 'string',
        'ResourceIds': [
            'string',
        ]
    },
    Limit=123,
    NextToken='string'
)
type ConformancePackName

string

param ConformancePackName

[REQUIRED]

Name of the conformance pack.

type Filters

dict

param Filters

A ConformancePackEvaluationFilters object.

  • ConfigRuleNames (list) --

    Filters the results by Config rule names.

    • (string) --

  • ComplianceType (string) --

    Filters the results by compliance.

    The allowed values are COMPLIANT and NON_COMPLIANT . INSUFFICIENT_DATA is not supported.

  • ResourceType (string) --

    Filters the results by the resource type (for example, "AWS::EC2::Instance" ).

  • ResourceIds (list) --

    Filters the results by resource IDs.

    Note

    This is valid only when you provide resource type. If there is no resource type, you will see an error.

    • (string) --

type Limit

integer

param Limit

The maximum number of evaluation results returned on each page. If you do no specify a number, Config uses the default. The default is 100.

type NextToken

string

param NextToken

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

rtype

dict

returns

Response Syntax

{
    'ConformancePackName': 'string',
    'ConformancePackRuleEvaluationResults': [
        {
            'ComplianceType': 'COMPLIANT'|'NON_COMPLIANT'|'INSUFFICIENT_DATA',
            'EvaluationResultIdentifier': {
                'EvaluationResultQualifier': {
                    'ConfigRuleName': 'string',
                    'ResourceType': 'string',
                    'ResourceId': 'string',
                    'EvaluationMode': 'DETECTIVE'|'PROACTIVE'
                },
                'OrderingTimestamp': datetime(2015, 1, 1),
                'ResourceEvaluationId': 'string'
            },
            'ConfigRuleInvokedTime': datetime(2015, 1, 1),
            'ResultRecordedTime': datetime(2015, 1, 1),
            'Annotation': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • ConformancePackName (string) --

      Name of the conformance pack.

    • ConformancePackRuleEvaluationResults (list) --

      Returns a list of ConformancePackEvaluationResult objects.

      • (dict) --

        The details of a conformance pack evaluation. Provides Config rule and Amazon Web Services resource type that was evaluated, the compliance of the conformance pack, related time stamps, and supplementary information.

        • ComplianceType (string) --

          The compliance type. The allowed values are COMPLIANT and NON_COMPLIANT . INSUFFICIENT_DATA is not supported.

        • EvaluationResultIdentifier (dict) --

          Uniquely identifies an evaluation result.

          • EvaluationResultQualifier (dict) --

            Identifies an Config rule used to evaluate an Amazon Web Services resource, and provides the type and ID of the evaluated resource.

            • ConfigRuleName (string) --

              The name of the Config rule that was used in the evaluation.

            • ResourceType (string) --

              The type of Amazon Web Services resource that was evaluated.

            • ResourceId (string) --

              The ID of the evaluated Amazon Web Services resource.

            • EvaluationMode (string) --

              The mode of an evaluation. The valid values are Detective or Proactive.

          • OrderingTimestamp (datetime) --

            The time of the event that triggered the evaluation of your Amazon Web Services resources. The time can indicate when Config delivered a configuration item change notification, or it can indicate when Config delivered the configuration snapshot, depending on which event triggered the evaluation.

          • ResourceEvaluationId (string) --

            A Unique ID for an evaluation result.

        • ConfigRuleInvokedTime (datetime) --

          The time when Config rule evaluated Amazon Web Services resource.

        • ResultRecordedTime (datetime) --

          The time when Config recorded the evaluation result.

        • Annotation (string) --

          Supplementary information about how the evaluation determined the compliance.

    • NextToken (string) --

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

PutConfigRule (updated) Link ¶
Changes (request)
{'ConfigRule': {'EvaluationModes': [{'Mode': 'DETECTIVE | PROACTIVE'}]}}

Adds or updates an Config rule to evaluate if your Amazon Web Services resources comply with your desired configurations. For information on how many Config rules you can have per account, see **Service Limits** in the Config Developer Guide .

There are two types of rules: Config Custom Rules and Config Managed Rules. You can use PutConfigRule to create both Config custom rules and Config managed rules.

Custom rules are rules that you can create using either Guard or Lambda functions. Guard ( Guard GitHub Repository ) is a policy-as-code language that allows you to write policies that are enforced by Config Custom Policy rules. Lambda uses custom code that you upload to evaluate a custom rule. If you are adding a new Custom Lambda rule, you first need to create an Lambda function that the rule invokes to evaluate your resources. When you use PutConfigRule to add a Custom Lambda rule to Config, you must specify the Amazon Resource Name (ARN) that Lambda assigns to the function. You specify the ARN in the SourceIdentifier key. This key is part of the Source object, which is part of the ConfigRule object.

Managed rules are predefined, customizable rules created by Config. For a list of managed rules, see List of Config Managed Rules. If you are adding an Config managed rule, you must specify the rule's identifier for the SourceIdentifier key.

For any new rule that you add, specify the ConfigRuleName in the ConfigRule object. Do not specify the ConfigRuleArn or the ConfigRuleId . These values are generated by Config for new rules.

If you are updating a rule that you added previously, you can specify the rule by ConfigRuleName , ConfigRuleId , or ConfigRuleArn in the ConfigRule data type that you use in this request.

For more information about developing and using Config rules, see Evaluating Amazon Web Services resource Configurations with Config in the Config Developer Guide .

See also: AWS API Documentation

Request Syntax

client.put_config_rule(
    ConfigRule={
        'ConfigRuleName': 'string',
        'ConfigRuleArn': 'string',
        'ConfigRuleId': 'string',
        'Description': 'string',
        'Scope': {
            'ComplianceResourceTypes': [
                'string',
            ],
            'TagKey': 'string',
            'TagValue': 'string',
            'ComplianceResourceId': 'string'
        },
        'Source': {
            'Owner': 'CUSTOM_LAMBDA'|'AWS'|'CUSTOM_POLICY',
            'SourceIdentifier': 'string',
            'SourceDetails': [
                {
                    'EventSource': 'aws.config',
                    'MessageType': 'ConfigurationItemChangeNotification'|'ConfigurationSnapshotDeliveryCompleted'|'ScheduledNotification'|'OversizedConfigurationItemChangeNotification',
                    'MaximumExecutionFrequency': 'One_Hour'|'Three_Hours'|'Six_Hours'|'Twelve_Hours'|'TwentyFour_Hours'
                },
            ],
            'CustomPolicyDetails': {
                'PolicyRuntime': 'string',
                'PolicyText': 'string',
                'EnableDebugLogDelivery': True|False
            }
        },
        'InputParameters': 'string',
        'MaximumExecutionFrequency': 'One_Hour'|'Three_Hours'|'Six_Hours'|'Twelve_Hours'|'TwentyFour_Hours',
        'ConfigRuleState': 'ACTIVE'|'DELETING'|'DELETING_RESULTS'|'EVALUATING',
        'CreatedBy': 'string',
        'EvaluationModes': [
            {
                'Mode': 'DETECTIVE'|'PROACTIVE'
            },
        ]
    },
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type ConfigRule

dict

param ConfigRule

[REQUIRED]

The rule that you want to add to your account.

  • ConfigRuleName (string) --

    The name that you assign to the Config rule. The name is required if you are adding a new rule.

  • ConfigRuleArn (string) --

    The Amazon Resource Name (ARN) of the Config rule.

  • ConfigRuleId (string) --

    The ID of the Config rule.

  • Description (string) --

    The description that you provide for the Config rule.

  • Scope (dict) --

    Defines which resources can trigger an evaluation for the rule. The scope can include one or more resource types, a combination of one resource type and one resource ID, or a combination of a tag key and value. Specify a scope to constrain the resources that can trigger an evaluation for the rule. If you do not specify a scope, evaluations are triggered when any resource in the recording group changes.

    Note

    The scope can be empty.

    • ComplianceResourceTypes (list) --

      The resource types of only those Amazon Web Services resources that you want to trigger an evaluation for the rule. You can only specify one type if you also specify a resource ID for ComplianceResourceId .

      • (string) --

    • TagKey (string) --

      The tag key that is applied to only those Amazon Web Services resources that you want to trigger an evaluation for the rule.

    • TagValue (string) --

      The tag value applied to only those Amazon Web Services resources that you want to trigger an evaluation for the rule. If you specify a value for TagValue , you must also specify a value for TagKey .

    • ComplianceResourceId (string) --

      The ID of the only Amazon Web Services resource that you want to trigger an evaluation for the rule. If you specify a resource ID, you must specify one resource type for ComplianceResourceTypes .

  • Source (dict) -- [REQUIRED]

    Provides the rule owner ( Amazon Web Services for managed rules, CUSTOM_POLICY for Custom Policy rules, and CUSTOM_LAMBDA for Custom Lambda rules), the rule identifier, and the notifications that cause the function to evaluate your Amazon Web Services resources.

    • Owner (string) -- [REQUIRED]

      Indicates whether Amazon Web Services or the customer owns and manages the Config rule.

      Config Managed Rules are predefined rules owned by Amazon Web Services. For more information, see Config Managed Rules in the Config developer guide .

      Config Custom Rules are rules that you can develop either with Guard ( CUSTOM_POLICY ) or Lambda ( CUSTOM_LAMBDA ). For more information, see Config Custom Rules in the Config developer guide .

    • SourceIdentifier (string) --

      For Config Managed rules, a predefined identifier from a list. For example, IAM_PASSWORD_POLICY is a managed rule. To reference a managed rule, see List of Config Managed Rules.

      For Config Custom Lambda rules, the identifier is the Amazon Resource Name (ARN) of the rule's Lambda function, such as arn:aws:lambda:us-east-2:123456789012:function:custom_rule_name .

      For Config Custom Policy rules, this field will be ignored.

    • SourceDetails (list) --

      Provides the source and the message types that cause Config to evaluate your Amazon Web Services resources against a rule. It also provides the frequency with which you want Config to run evaluations for the rule if the trigger type is periodic.

      If the owner is set to CUSTOM_POLICY , the only acceptable values for the Config rule trigger message type are ConfigurationItemChangeNotification and OversizedConfigurationItemChangeNotification .

      • (dict) --

        Provides the source and the message types that trigger Config to evaluate your Amazon Web Services resources against a rule. It also provides the frequency with which you want Config to run evaluations for the rule if the trigger type is periodic. You can specify the parameter values for SourceDetail only for custom rules.

        • EventSource (string) --

          The source of the event, such as an Amazon Web Services service, that triggers Config to evaluate your Amazon Web Services resources.

        • MessageType (string) --

          The type of notification that triggers Config to run an evaluation for a rule. You can specify the following notification types:

          • ConfigurationItemChangeNotification - Triggers an evaluation when Config delivers a configuration item as a result of a resource change.

          • OversizedConfigurationItemChangeNotification - Triggers an evaluation when Config delivers an oversized configuration item. Config may generate this notification type when a resource changes and the notification exceeds the maximum size allowed by Amazon SNS.

          • ScheduledNotification - Triggers a periodic evaluation at the frequency specified for MaximumExecutionFrequency .

          • ConfigurationSnapshotDeliveryCompleted - Triggers a periodic evaluation when Config delivers a configuration snapshot.

          If you want your custom rule to be triggered by configuration changes, specify two SourceDetail objects, one for ConfigurationItemChangeNotification and one for OversizedConfigurationItemChangeNotification .

        • MaximumExecutionFrequency (string) --

          The frequency at which you want Config to run evaluations for a custom rule with a periodic trigger. If you specify a value for MaximumExecutionFrequency , then MessageType must use the ScheduledNotification value.

          Note

          By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

          Based on the valid value you choose, Config runs evaluations once for each valid value. For example, if you choose Three_Hours , Config runs evaluations once every three hours. In this case, Three_Hours is the frequency of this rule.

    • CustomPolicyDetails (dict) --

      Provides the runtime system, policy definition, and whether debug logging is enabled. Required when owner is set to CUSTOM_POLICY .

      • PolicyRuntime (string) -- [REQUIRED]

        The runtime system for your Config Custom Policy rule. Guard is a policy-as-code language that allows you to write policies that are enforced by Config Custom Policy rules. For more information about Guard, see the Guard GitHub Repository.

      • PolicyText (string) -- [REQUIRED]

        The policy definition containing the logic for your Config Custom Policy rule.

      • EnableDebugLogDelivery (boolean) --

        The boolean expression for enabling debug logging for your Config Custom Policy rule. The default value is false .

  • InputParameters (string) --

    A string, in JSON format, that is passed to the Config rule Lambda function.

  • MaximumExecutionFrequency (string) --

    The maximum frequency with which Config runs evaluations for a rule. You can specify a value for MaximumExecutionFrequency when:

    • This is for an Config managed rule that is triggered at a periodic frequency.

    • Your custom rule is triggered when Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.

    Note

    By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

  • ConfigRuleState (string) --

    Indicates whether the Config rule is active or is currently being deleted by Config. It can also indicate the evaluation status for the Config rule.

    Config sets the state of the rule to EVALUATING temporarily after you use the StartConfigRulesEvaluation request to evaluate your resources against the Config rule.

    Config sets the state of the rule to DELETING_RESULTS temporarily after you use the DeleteEvaluationResults request to delete the current evaluation results for the Config rule.

    Config temporarily sets the state of a rule to DELETING after you use the DeleteConfigRule request to delete the rule. After Config deletes the rule, the rule and all of its evaluations are erased and are no longer available.

  • CreatedBy (string) --

    Service principal name of the service that created the rule.

    Note

    The field is populated only if the service-linked rule is created by a service. The field is empty if you create your own rule.

  • EvaluationModes (list) --

    The modes the Config rule can be evaluated in. The valid values are distinct objects. By default, the value is Detective evaluation mode only.

    • (dict) --

      The configuration object for Config rule evaluation mode. The Supported valid values are Detective or Proactive.

      • Mode (string) --

        The mode of an evaluation. The valid values are Detective or Proactive.

type Tags

list

param Tags

An array of tag object.

  • (dict) --

    The tags for the resource. The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

    • Key (string) --

      One part of a key-value pair that make up a tag. A key is a general label that acts like a category for more specific tag values.

    • Value (string) --

      The optional part of a key-value pair that make up a tag. A value acts as a descriptor within a tag category (key).

returns

None