Class CfnConfigRule
A CloudFormation AWS::Config::ConfigRule
.
Inherited Members
Namespace: Amazon.CDK.AWS.Config
Assembly: Amazon.CDK.AWS.Config.dll
Syntax (csharp)
public class CfnConfigRule : CfnResource, IConstruct, IDependable, IInspectable
Syntax (vb)
Public Class CfnConfigRule
Inherits CfnResource
Implements IConstruct, IDependable, IInspectable
Remarks
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 Service Limits 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 . 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 ) and with Guard ( Guard GitHub Repository ), 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 in the AWS Config Developer Guide .
CloudformationResource: AWS::Config::ConfigRule
Link: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configrule.html
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Config;
var inputParameters;
var cfnConfigRule = new CfnConfigRule(this, "MyCfnConfigRule", new CfnConfigRuleProps {
Source = new SourceProperty {
Owner = "owner",
// the properties below are optional
CustomPolicyDetails = new CustomPolicyDetailsProperty {
EnableDebugLogDelivery = false,
PolicyRuntime = "policyRuntime",
PolicyText = "policyText"
},
SourceDetails = new [] { new SourceDetailProperty {
EventSource = "eventSource",
MessageType = "messageType",
// the properties below are optional
MaximumExecutionFrequency = "maximumExecutionFrequency"
} },
SourceIdentifier = "sourceIdentifier"
},
// the properties below are optional
ConfigRuleName = "configRuleName",
Description = "description",
InputParameters = inputParameters,
MaximumExecutionFrequency = "maximumExecutionFrequency",
Scope = new ScopeProperty {
ComplianceResourceId = "complianceResourceId",
ComplianceResourceTypes = new [] { "complianceResourceTypes" },
TagKey = "tagKey",
TagValue = "tagValue"
}
});
Synopsis
Constructors
CfnConfigRule(Construct, String, ICfnConfigRuleProps) | Create a new |
CfnConfigRule(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnConfigRule(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
AttrArn | The Amazon Resource Name (ARN) of the AWS Config rule, such as |
AttrComplianceType | The compliance status of an AWS Config rule, such as |
AttrConfigRuleId | The ID of the AWS Config rule, such as |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
ConfigRuleName | A name for the AWS Config rule. |
Description | The description that you provide for the AWS Config rule. |
InputParameters | A string, in JSON format, that is passed to the AWS Config rule Lambda function. |
MaximumExecutionFrequency | The maximum frequency with which AWS Config runs evaluations for a rule. |
Scope | Defines which resources can trigger an evaluation for the rule. |
Source | Provides the rule owner ( |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnConfigRule(Construct, String, ICfnConfigRuleProps)
Create a new AWS::Config::ConfigRule
.
public CfnConfigRule(Construct scope, string id, ICfnConfigRuleProps props)
Parameters
- scope Construct
- scope in which this resource is defined.
- id System.String
- scoped id of the resource.
- props ICfnConfigRuleProps
- resource properties.
CfnConfigRule(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnConfigRule(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnConfigRule(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnConfigRule(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
AttrArn
The Amazon Resource Name (ARN) of the AWS Config rule, such as arn:aws:config:us-east-1:123456789012:config-rule/config-rule-a1bzhi
.
public virtual string AttrArn { get; }
Property Value
System.String
Remarks
CloudformationAttribute: Arn
AttrComplianceType
The compliance status of an AWS Config rule, such as COMPLIANT
or NON_COMPLIANT
.
public virtual string AttrComplianceType { get; }
Property Value
System.String
Remarks
CloudformationAttribute: Compliance.Type
AttrConfigRuleId
The ID of the AWS Config rule, such as config-rule-a1bzhi
.
public virtual string AttrConfigRuleId { get; }
Property Value
System.String
Remarks
CloudformationAttribute: ConfigRuleId
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
ConfigRuleName
A name for the AWS Config rule.
public virtual string ConfigRuleName { get; set; }
Property Value
System.String
Remarks
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the rule name. For more information, see Name Type .
Description
The description that you provide for the AWS Config rule.
public virtual string Description { get; set; }
Property Value
System.String
Remarks
InputParameters
A string, in JSON format, that is passed to the AWS Config rule Lambda function.
public virtual object InputParameters { get; set; }
Property Value
System.Object
Remarks
MaximumExecutionFrequency
The maximum frequency with which AWS Config runs evaluations for a rule.
public virtual string MaximumExecutionFrequency { get; set; }
Property Value
System.String
Remarks
You can specify a value for MaximumExecutionFrequency
when:
By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the <code>MaximumExecutionFrequency</code> parameter.
Scope
Defines which resources can trigger an evaluation for the rule.
public virtual object Scope { get; set; }
Property Value
System.Object
Remarks
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.
The scope can be empty.
Source
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.
public virtual object Source { get; set; }
Property Value
System.Object
Remarks
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
- tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>