

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::Config::ConfigRule
<a name="aws-resource-config-configrule"></a>

**Note**  
You must first create and start the AWS Config configuration recorder in order to create AWS Config managed rules with AWS CloudFormation. For more information, see [Managing the Configuration Recorder](https://docs.aws.amazon.com/config/latest/developerguide/stop-start-recorder.html).

Adds or updates an AWS Config rule to evaluate if your AWS resources comply with your desired configurations. For information on how many AWS Config rules you can have per account, see [https://docs.aws.amazon.com/config/latest/developerguide/configlimits.html](https://docs.aws.amazon.com/config/latest/developerguide/configlimits.html) in the *AWS Config Developer Guide*.

There are two types of rules: *AWS Config Managed Rules* and *AWS Config Custom Rules*. You can use the `ConfigRule` resource to create both AWS Config Managed Rules and AWS Config Custom Rules.

AWS Config Managed Rules are predefined, customizable rules created by AWS Config. For a list of managed rules, see [List of AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html). If you are adding an AWS Config managed rule, you must specify the rule's identifier for the `SourceIdentifier` key.

AWS Config Custom Rules are rules that you create from scratch. There are two ways to create AWS Config custom rules: with Lambda functions ([AWS Lambda Developer Guide](https://docs.aws.amazon.com/config/latest/developerguide/gettingstarted-concepts.html#gettingstarted-concepts-function)) and with Guard ([Guard GitHub Repository](https://github.com/aws-cloudformation/cloudformation-guard)), a policy-as-code language. AWS Config custom rules created with AWS Lambda are called *AWS Config Custom Lambda Rules* and AWS Config custom rules created with Guard are called *AWS Config Custom Policy Rules*.

If you are adding a new AWS Config Custom Lambda rule, you first need to create an AWS Lambda function that the rule invokes to evaluate your resources. When you use the `ConfigRule` resource to add a Custom Lambda rule to AWS Config, you must specify the Amazon Resource Name (ARN) that AWS 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. 

For any new AWS Config rule that you add, specify the `ConfigRuleName` in the `ConfigRule` object. Do not specify the `ConfigRuleArn` or the `ConfigRuleId`. These values are generated by AWS 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 AWS Config rules, see [Evaluating Resources with AWS Config Rules](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html) in the *AWS Config Developer Guide*.

## Syntax
<a name="aws-resource-config-configrule-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-config-configrule-syntax.json"></a>

```
{
  "Type" : "AWS::Config::ConfigRule",
  "Properties" : {
      "[Compliance](#cfn-config-configrule-compliance)" : Compliance,
      "[ConfigRuleName](#cfn-config-configrule-configrulename)" : String,
      "[Description](#cfn-config-configrule-description)" : String,
      "[EvaluationModes](#cfn-config-configrule-evaluationmodes)" : [ EvaluationModeConfiguration, ... ],
      "[InputParameters](#cfn-config-configrule-inputparameters)" : Json,
      "[MaximumExecutionFrequency](#cfn-config-configrule-maximumexecutionfrequency)" : String,
      "[Scope](#cfn-config-configrule-scope)" : Scope,
      "[Source](#cfn-config-configrule-source)" : Source
    }
}
```

### YAML
<a name="aws-resource-config-configrule-syntax.yaml"></a>

```
Type: AWS::Config::ConfigRule
Properties:
  [Compliance](#cfn-config-configrule-compliance): 
    Compliance
  [ConfigRuleName](#cfn-config-configrule-configrulename): String
  [Description](#cfn-config-configrule-description): String
  [EvaluationModes](#cfn-config-configrule-evaluationmodes): 
    - EvaluationModeConfiguration
  [InputParameters](#cfn-config-configrule-inputparameters): Json
  [MaximumExecutionFrequency](#cfn-config-configrule-maximumexecutionfrequency): String
  [Scope](#cfn-config-configrule-scope): 
    Scope
  [Source](#cfn-config-configrule-source): 
    Source
```

## Properties
<a name="aws-resource-config-configrule-properties"></a>

`Compliance`  <a name="cfn-config-configrule-compliance"></a>
Indicates whether an AWS resource or AWS Config rule is compliant and provides the number of contributors that affect the compliance.  
*Required*: No  
*Type*: [Compliance](aws-properties-config-configrule-compliance.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ConfigRuleName`  <a name="cfn-config-configrule-configrulename"></a>
A name for the AWS Config rule. If you don't specify a name, CloudFormation generates a unique physical ID and uses that ID for the rule name. For more information, see [Name Type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html).   
*Required*: No  
*Type*: String  
*Pattern*: `.*\S.*`  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Description`  <a name="cfn-config-configrule-description"></a>
The description that you provide for the AWS Config rule.  
*Required*: No  
*Type*: String  
*Minimum*: `0`  
*Maximum*: `256`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`EvaluationModes`  <a name="cfn-config-configrule-evaluationmodes"></a>
The modes the AWS Config rule can be evaluated in. The valid values are distinct objects. By default, the value is Detective evaluation mode only.  
*Required*: No  
*Type*: Array of [EvaluationModeConfiguration](aws-properties-config-configrule-evaluationmodeconfiguration.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`InputParameters`  <a name="cfn-config-configrule-inputparameters"></a>
A string, in JSON format, that is passed to the AWS Config rule Lambda function.  
*Required*: No  
*Type*: Json  
*Minimum*: `1`  
*Maximum*: `1024`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`MaximumExecutionFrequency`  <a name="cfn-config-configrule-maximumexecutionfrequency"></a>
The maximum frequency with which AWS Config runs evaluations for a rule. You can specify a value for `MaximumExecutionFrequency` when:  
+ You are using an AWS managed rule that is triggered at a periodic frequency.
+ Your custom rule is triggered when AWS Config delivers the configuration snapshot. For more information, see [ConfigSnapshotDeliveryProperties](https://docs.aws.amazon.com/config/latest/APIReference/API_ConfigSnapshotDeliveryProperties.html).
By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the `MaximumExecutionFrequency` parameter.
*Required*: No  
*Type*: String  
*Allowed values*: `One_Hour | Three_Hours | Six_Hours | Twelve_Hours | TwentyFour_Hours`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Scope`  <a name="cfn-config-configrule-scope"></a>
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.  
*Required*: No  
*Type*: [Scope](aws-properties-config-configrule-scope.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Source`  <a name="cfn-config-configrule-source"></a>
Provides the rule owner (` AWS ` 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 AWS resources.  
*Required*: Yes  
*Type*: [Source](aws-properties-config-configrule-source.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Return values
<a name="aws-resource-config-configrule-return-values"></a>

### Ref
<a name="aws-resource-config-configrule-return-values-ref"></a>

When you pass the logical ID of this resource to the intrinsic `Ref` function, `Ref` returns the rule name, such as `mystack-MyConfigRule-12ABCFPXHV4OV`.

For more information about using the `Ref` function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-ref.html).

### Fn::GetAtt
<a name="aws-resource-config-configrule-return-values-fn--getatt"></a>

The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using the `Fn::GetAtt` intrinsic function, see [https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/intrinsic-function-reference-getatt.html).

#### 
<a name="aws-resource-config-configrule-return-values-fn--getatt-fn--getatt"></a>

`Arn`  <a name="Arn-fn::getatt"></a>
The Amazon Resource Name (ARN) of the AWS Config rule, such as `arn:aws:config:us-east-1:123456789012:config-rule/config-rule-a1bzhi`.

`Compliance.Type`  <a name="Compliance.Type-fn::getatt"></a>
Property description not available.

`ConfigRuleId`  <a name="ConfigRuleId-fn::getatt"></a>
The ID of the AWS Config rule, such as `config-rule-a1bzhi`.

## Examples
<a name="aws-resource-config-configrule--examples"></a>



**Topics**
+ [Config Rule](#aws-resource-config-configrule--examples--Config_Rule)
+ [Create Rule Using Lambda Function](#aws-resource-config-configrule--examples--Create_Rule_Using_Lambda_Function)

### Config Rule
<a name="aws-resource-config-configrule--examples--Config_Rule"></a>

The following example uses an AWS managed rule that checks whether EC2 volumes resource types have a CostCenter tag.

#### JSON
<a name="aws-resource-config-configrule--examples--Config_Rule--json"></a>

```
"ConfigRuleForVolumeTags": {
  "Type": "AWS::Config::ConfigRule",
  "Properties": {
    "InputParameters": {"tag1Key": "CostCenter"},
    "Scope": {
      "ComplianceResourceTypes": ["AWS::EC2::Volume"]
    },
    "Source": {
      "Owner": "AWS",
      "SourceIdentifier": "REQUIRED_TAGS"
    }
  }
}
```

#### YAML
<a name="aws-resource-config-configrule--examples--Config_Rule--yaml"></a>

```
ConfigRuleForVolumeTags: 
  Type: AWS::Config::ConfigRule
  Properties: 
    InputParameters: |
        {"tag1Key": "CostCenter"}
    Scope: 
      ComplianceResourceTypes: 
        - "AWS::EC2::Volume"
    Source: 
      Owner: AWS
      SourceIdentifier: "REQUIRED_TAGS"
```

### Create Rule Using Lambda Function
<a name="aws-resource-config-configrule--examples--Create_Rule_Using_Lambda_Function"></a>

The following example is the AWS Lambda function’s code to check whether an EC2 volume has the AutoEnableIO property set to true. To deploy with AWS CloudFormation, follow the steps in [Deploy Node.js Lambda functions with .zip file archives](https://docs.aws.amazon.com/lambda/latest/dg/nodejs-package.html).

#### 
<a name="aws-resource-config-configrule--examples--Create_Rule_Using_Lambda_Function--javascript"></a>

```
import { ConfigServiceClient, PutEvaluationsCommand } from "@aws-sdk/client-config-service";
import { EC2Client, DescribeVolumeAttributeCommand } from "@aws-sdk/client-ec2"
              
const configClient = new ConfigServiceClient({});
const ec2Client = new EC2Client({});
              
export const handler = async function (event, context) {
    await evaluateCompliance(event, async function (compliance, annotation, event) {
        var configurationItem = JSON.parse(event.invokingEvent).configurationItem;
        if (annotation) {
            var putEvaluationsRequest = {
                Evaluations: [{
                    ComplianceResourceType: configurationItem.resourceType,
                    ComplianceResourceId: configurationItem.resourceId,
                    ComplianceType: compliance,
                    OrderingTimestamp: new Date(configurationItem.configurationItemCaptureTime),
                    Annotation: annotation
                }],
              ResultToken: event.resultToken
            };
        } else {
            var putEvaluationsRequest = {
                Evaluations: [{
                    ComplianceResourceType: configurationItem.resourceType,
                    ComplianceResourceId: configurationItem.resourceId,
                    ComplianceType: compliance,
                    OrderingTimestamp: new Date(configurationItem.configurationItemCaptureTime)
                }],
                ResultToken: event.resultToken
            };
       }
       await configClient.send(new PutEvaluationsCommand(putEvaluationsRequest));
    });
};
async function evaluateCompliance(event, doReturn) {
    var configurationItem = JSON.parse(event.invokingEvent).configurationItem;
    var status = configurationItem.configurationItemStatus;
    if (configurationItem.resourceType !== 'AWS::EC2::Volume' || event.eventLeftScope || (status !== 'OK' && status !== 'ResourceDiscovered')) {
              doReturn('NOT_APPLICABLE', '', event);
    } else {
        const input = { VolumeId: configurationItem.resourceId, Attribute: 'autoEnableIO' };
        const command = new DescribeVolumeAttributeCommand(input);
        const response = await ec2Client.send(command);
        if (response.AutoEnableIO.Value) doReturn('COMPLIANT', '', event);
        else doReturn('NON_COMPLIANT', 'Annotation describing why NON_COMPLIANT', event);
    };
}
```

# AWS::Config::ConfigRule Compliance
<a name="aws-properties-config-configrule-compliance"></a>

Indicates whether an AWS resource or AWS Config rule is compliant and provides the number of contributors that affect the compliance.

## Syntax
<a name="aws-properties-config-configrule-compliance-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-config-configrule-compliance-syntax.json"></a>

```
{
  "[Type](#cfn-config-configrule-compliance-type)" : String
}
```

### YAML
<a name="aws-properties-config-configrule-compliance-syntax.yaml"></a>

```
  [Type](#cfn-config-configrule-compliance-type): String
```

## Properties
<a name="aws-properties-config-configrule-compliance-properties"></a>

`Type`  <a name="cfn-config-configrule-compliance-type"></a>
Indicates whether an AWS resource or AWS Config rule is compliant.  
A resource is compliant if it complies with all of the AWS 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.  
AWS Config returns the `INSUFFICIENT_DATA` value when no evaluation results are available for the AWS resource or AWS Config rule.  
For the `Compliance` data type, AWS Config supports only `COMPLIANT`, `NON_COMPLIANT`, and `INSUFFICIENT_DATA` values. AWS Config does not support the `NOT_APPLICABLE` value for the `Compliance` data type.  
*Required*: No  
*Type*: String  
*Allowed values*: `COMPLIANT | NON_COMPLIANT | NOT_APPLICABLE | INSUFFICIENT_DATA`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::Config::ConfigRule CustomPolicyDetails
<a name="aws-properties-config-configrule-custompolicydetails"></a>

Provides the CustomPolicyDetails, the rule owner (` AWS ` for managed rules, `CUSTOM_POLICY` for Custom Policy rules, and `CUSTOM_LAMBDA` for Custom Lambda rules), the rule identifier, and the events that cause the evaluation of your AWS resources.

## Syntax
<a name="aws-properties-config-configrule-custompolicydetails-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-config-configrule-custompolicydetails-syntax.json"></a>

```
{
  "[EnableDebugLogDelivery](#cfn-config-configrule-custompolicydetails-enabledebuglogdelivery)" : Boolean,
  "[PolicyRuntime](#cfn-config-configrule-custompolicydetails-policyruntime)" : String,
  "[PolicyText](#cfn-config-configrule-custompolicydetails-policytext)" : String
}
```

### YAML
<a name="aws-properties-config-configrule-custompolicydetails-syntax.yaml"></a>

```
  [EnableDebugLogDelivery](#cfn-config-configrule-custompolicydetails-enabledebuglogdelivery): Boolean
  [PolicyRuntime](#cfn-config-configrule-custompolicydetails-policyruntime): String
  [PolicyText](#cfn-config-configrule-custompolicydetails-policytext): String
```

## Properties
<a name="aws-properties-config-configrule-custompolicydetails-properties"></a>

`EnableDebugLogDelivery`  <a name="cfn-config-configrule-custompolicydetails-enabledebuglogdelivery"></a>
The boolean expression for enabling debug logging for your AWS Config Custom Policy rule. The default value is `false`.  
*Required*: No  
*Type*: Boolean  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`PolicyRuntime`  <a name="cfn-config-configrule-custompolicydetails-policyruntime"></a>
The runtime system for your AWS Config Custom Policy rule. Guard is a policy-as-code language that allows you to write policies that are enforced by AWS Config Custom Policy rules. For more information about Guard, see the [Guard GitHub Repository](https://github.com/aws-cloudformation/cloudformation-guard).  
*Required*: No  
*Type*: String  
*Pattern*: `guard\-2\.x\.x`  
*Minimum*: `1`  
*Maximum*: `64`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`PolicyText`  <a name="cfn-config-configrule-custompolicydetails-policytext"></a>
The policy definition containing the logic for your AWS Config Custom Policy rule.  
*Required*: No  
*Type*: String  
*Minimum*: `0`  
*Maximum*: `10000`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::Config::ConfigRule EvaluationModeConfiguration
<a name="aws-properties-config-configrule-evaluationmodeconfiguration"></a>

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

## Syntax
<a name="aws-properties-config-configrule-evaluationmodeconfiguration-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-config-configrule-evaluationmodeconfiguration-syntax.json"></a>

```
{
  "[Mode](#cfn-config-configrule-evaluationmodeconfiguration-mode)" : String
}
```

### YAML
<a name="aws-properties-config-configrule-evaluationmodeconfiguration-syntax.yaml"></a>

```
  [Mode](#cfn-config-configrule-evaluationmodeconfiguration-mode): String
```

## Properties
<a name="aws-properties-config-configrule-evaluationmodeconfiguration-properties"></a>

`Mode`  <a name="cfn-config-configrule-evaluationmodeconfiguration-mode"></a>
The mode of an evaluation. The valid values are Detective or Proactive.  
*Required*: No  
*Type*: String  
*Allowed values*: `DETECTIVE | PROACTIVE`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::Config::ConfigRule Scope
<a name="aws-properties-config-configrule-scope"></a>

Defines which resources trigger an evaluation for an AWS Config rule. The scope can include one or more resource types, a combination of a tag key and value, or a combination of one resource type and one resource ID. Specify a scope to constrain which resources trigger an evaluation for a rule. Otherwise, evaluations for the rule are triggered when any resource in your recording group changes in configuration.

## Syntax
<a name="aws-properties-config-configrule-scope-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-config-configrule-scope-syntax.json"></a>

```
{
  "[ComplianceResourceId](#cfn-config-configrule-scope-complianceresourceid)" : String,
  "[ComplianceResourceTypes](#cfn-config-configrule-scope-complianceresourcetypes)" : [ String, ... ],
  "[TagKey](#cfn-config-configrule-scope-tagkey)" : String,
  "[TagValue](#cfn-config-configrule-scope-tagvalue)" : String
}
```

### YAML
<a name="aws-properties-config-configrule-scope-syntax.yaml"></a>

```
  [ComplianceResourceId](#cfn-config-configrule-scope-complianceresourceid): String
  [ComplianceResourceTypes](#cfn-config-configrule-scope-complianceresourcetypes): 
    - String
  [TagKey](#cfn-config-configrule-scope-tagkey): String
  [TagValue](#cfn-config-configrule-scope-tagvalue): String
```

## Properties
<a name="aws-properties-config-configrule-scope-properties"></a>

`ComplianceResourceId`  <a name="cfn-config-configrule-scope-complianceresourceid"></a>
The ID of the only AWS 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`.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `768`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`ComplianceResourceTypes`  <a name="cfn-config-configrule-scope-complianceresourcetypes"></a>
The resource types of only those AWS 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`.  
*Required*: No  
*Type*: Array of String  
*Minimum*: `0`  
*Maximum*: `100`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TagKey`  <a name="cfn-config-configrule-scope-tagkey"></a>
The tag key that is applied to only those AWS resources that you want to trigger an evaluation for the rule.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`TagValue`  <a name="cfn-config-configrule-scope-tagvalue"></a>
The tag value applied to only those AWS 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`.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `256`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

## Examples
<a name="aws-properties-config-configrule-scope--examples"></a>



**Topics**
+ [Multiple Resource Types with Tag-Based Scope](#aws-properties-config-configrule-scope--examples--Multiple_Resource_Types_with_Tag-Based_Scope)
+ [Single Resource Specific Scope](#aws-properties-config-configrule-scope--examples--Single_Resource_Specific_Scope)

### Multiple Resource Types with Tag-Based Scope
<a name="aws-properties-config-configrule-scope--examples--Multiple_Resource_Types_with_Tag-Based_Scope"></a>

This example configures AWS Config to evaluate both Amazon EC2 instances and volumes that are tagged with "`Environment`=`Production`". This is useful when you want to monitor compliance for multiple resource types that share specific tags.

#### YAML
<a name="aws-properties-config-configrule-scope--examples--Multiple_Resource_Types_with_Tag-Based_Scope--yaml"></a>

```
Scope:
  ComplianceResourceTypes:
    - "AWS::EC2::Instance"
    - "AWS::EC2::Volume"
  TagKey: "Environment"
  TagValue: "Production"
```

#### JSON
<a name="aws-properties-config-configrule-scope--examples--Multiple_Resource_Types_with_Tag-Based_Scope--json"></a>

```
{
  "Scope": {
    "ComplianceResourceTypes": [
      "AWS::EC2::Instance",
      "AWS::EC2::Volume"
    ],
    "TagKey": "Environment",
    "TagValue": "Production"
  }
}
```

### Single Resource Specific Scope
<a name="aws-properties-config-configrule-scope--examples--Single_Resource_Specific_Scope"></a>

This example shows how to target a specific Amazon EC2 instance for evaluation using its resource ID. When using `ComplianceResourceId`, you must specify exactly one resource type in `ComplianceResourceTypes`.

#### YAML
<a name="aws-properties-config-configrule-scope--examples--Single_Resource_Specific_Scope--yaml"></a>

```
Scope:
  ComplianceResourceId: "i-1234567890abcdef0"
  ComplianceResourceTypes: 
    - "AWS::EC2::Instance"
```

#### JSON
<a name="aws-properties-config-configrule-scope--examples--Single_Resource_Specific_Scope--json"></a>

```
{
  "Scope": {
    "ComplianceResourceId": "i-1234567890abcdef0",
    "ComplianceResourceTypes": [
      "AWS::EC2::Instance"
    ]
  }
}
```

# AWS::Config::ConfigRule Source
<a name="aws-properties-config-configrule-source"></a>

Provides the CustomPolicyDetails, the rule owner (` AWS ` for managed rules, `CUSTOM_POLICY` for Custom Policy rules, and `CUSTOM_LAMBDA` for Custom Lambda rules), the rule identifier, and the events that cause the evaluation of your AWS resources.

## Syntax
<a name="aws-properties-config-configrule-source-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-config-configrule-source-syntax.json"></a>

```
{
  "[CustomPolicyDetails](#cfn-config-configrule-source-custompolicydetails)" : CustomPolicyDetails,
  "[Owner](#cfn-config-configrule-source-owner)" : String,
  "[SourceDetails](#cfn-config-configrule-source-sourcedetails)" : [ SourceDetail, ... ],
  "[SourceIdentifier](#cfn-config-configrule-source-sourceidentifier)" : String
}
```

### YAML
<a name="aws-properties-config-configrule-source-syntax.yaml"></a>

```
  [CustomPolicyDetails](#cfn-config-configrule-source-custompolicydetails): 
    CustomPolicyDetails
  [Owner](#cfn-config-configrule-source-owner): String
  [SourceDetails](#cfn-config-configrule-source-sourcedetails): 
    - SourceDetail
  [SourceIdentifier](#cfn-config-configrule-source-sourceidentifier): String
```

## Properties
<a name="aws-properties-config-configrule-source-properties"></a>

`CustomPolicyDetails`  <a name="cfn-config-configrule-source-custompolicydetails"></a>
Provides the runtime system, policy definition, and whether debug logging is enabled. Required when owner is set to `CUSTOM_POLICY`.  
*Required*: No  
*Type*: [CustomPolicyDetails](aws-properties-config-configrule-custompolicydetails.md)  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`Owner`  <a name="cfn-config-configrule-source-owner"></a>
Indicates whether AWS or the customer owns and manages the AWS Config rule.  
AWS Config Managed Rules are predefined rules owned by AWS. For more information, see [AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html) in the *AWS Config developer guide*.  
AWS Config Custom Rules are rules that you can develop either with Guard (`CUSTOM_POLICY`) or AWS Lambda (`CUSTOM_LAMBDA`). For more information, see [AWS Config Custom Rules ](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules.html) in the *AWS Config developer guide*.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `CUSTOM_LAMBDA | AWS | CUSTOM_POLICY`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`SourceDetails`  <a name="cfn-config-configrule-source-sourcedetails"></a>
Provides the source and the message types that cause AWS Config to evaluate your AWS resources against a rule. It also provides the frequency with which you want AWS 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 AWS Config rule trigger message type are `ConfigurationItemChangeNotification` and `OversizedConfigurationItemChangeNotification`.  
*Required*: No  
*Type*: Array of [SourceDetail](aws-properties-config-configrule-sourcedetail.md)  
*Minimum*: `0`  
*Maximum*: `25`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`SourceIdentifier`  <a name="cfn-config-configrule-source-sourceidentifier"></a>
For AWS 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 AWS Config Managed Rules](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html).  
For AWS Config Custom Lambda rules, the identifier is the Amazon Resource Name (ARN) of the rule's AWS Lambda function, such as `arn:aws:lambda:us-east-2:123456789012:function:custom_rule_name`.  
For AWS Config Custom Policy rules, this field will be ignored.  
*Required*: No  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `256`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

# AWS::Config::ConfigRule SourceDetail
<a name="aws-properties-config-configrule-sourcedetail"></a>

Provides the source and the message types that trigger AWS Config to evaluate your AWS resources against a rule. It also provides the frequency with which you want AWS 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. 

## Syntax
<a name="aws-properties-config-configrule-sourcedetail-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-config-configrule-sourcedetail-syntax.json"></a>

```
{
  "[EventSource](#cfn-config-configrule-sourcedetail-eventsource)" : String,
  "[MaximumExecutionFrequency](#cfn-config-configrule-sourcedetail-maximumexecutionfrequency)" : String,
  "[MessageType](#cfn-config-configrule-sourcedetail-messagetype)" : String
}
```

### YAML
<a name="aws-properties-config-configrule-sourcedetail-syntax.yaml"></a>

```
  [EventSource](#cfn-config-configrule-sourcedetail-eventsource): String
  [MaximumExecutionFrequency](#cfn-config-configrule-sourcedetail-maximumexecutionfrequency): String
  [MessageType](#cfn-config-configrule-sourcedetail-messagetype): String
```

## Properties
<a name="aws-properties-config-configrule-sourcedetail-properties"></a>

`EventSource`  <a name="cfn-config-configrule-sourcedetail-eventsource"></a>
The source of the event, such as an AWS service, that triggers AWS Config to evaluate your AWS resources.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `aws.config`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`MaximumExecutionFrequency`  <a name="cfn-config-configrule-sourcedetail-maximumexecutionfrequency"></a>
The frequency at which you want AWS 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.  
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, AWS Config runs evaluations once for each valid value. For example, if you choose `Three_Hours`, AWS Config runs evaluations once every three hours. In this case, `Three_Hours` is the frequency of this rule. 
*Required*: No  
*Type*: String  
*Allowed values*: `One_Hour | Three_Hours | Six_Hours | Twelve_Hours | TwentyFour_Hours`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)

`MessageType`  <a name="cfn-config-configrule-sourcedetail-messagetype"></a>
The type of notification that triggers AWS Config to run an evaluation for a rule. You can specify the following notification types:  
+ `ConfigurationItemChangeNotification` - Triggers an evaluation when AWS Config delivers a configuration item as a result of a resource change.
+ `OversizedConfigurationItemChangeNotification` - Triggers an evaluation when AWS Config delivers an oversized configuration item. AWS 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 AWS 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`.  
*Required*: Yes  
*Type*: String  
*Allowed values*: `ConfigurationItemChangeNotification | ConfigurationSnapshotDeliveryCompleted | ScheduledNotification | OversizedConfigurationItemChangeNotification`  
*Update requires*: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)