Class CfnConfigRule
You must first create and start the AWS Config configuration recorder in order to create AWS Config managed rules with AWS CloudFormation .
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.Config
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnConfigRule : CfnResource, IInspectable
Syntax (vb)
Public Class CfnConfigRule
Inherits CfnResource
Implements IInspectable
Remarks
For more information, see Managing the Configuration Recorder .
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 .
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-config-configrule.html
CloudformationResource: AWS::Config::ConfigRule
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
Compliance = new ComplianceProperty {
Type = "type"
},
ConfigRuleName = "configRuleName",
Description = "description",
EvaluationModes = new [] { new EvaluationModeConfigurationProperty {
Mode = "mode"
} },
InputParameters = inputParameters,
MaximumExecutionFrequency = "maximumExecutionFrequency",
Scope = new ScopeProperty {
ComplianceResourceId = "complianceResourceId",
ComplianceResourceTypes = new [] { "complianceResourceTypes" },
TagKey = "tagKey",
TagValue = "tagValue"
}
});
Synopsis
Constructors
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 |
CfnConfigRule(Construct, String, ICfnConfigRuleProps) |
Properties
AttrArn | The Amazon Resource Name (ARN) of the AWS Config rule, such as |
AttrComplianceType | Compliance type determined by the Config rule. |
AttrConfigRuleId | The ID of the AWS Config rule, such as |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
Compliance | Indicates whether an AWS resource or AWS Config rule is compliant and provides the number of contributors that affect the compliance. |
ConfigRuleName | A name for the AWS Config rule. |
Description | The description that you provide for the AWS Config rule. |
EvaluationModes | The modes the AWS Config rule can be evaluated in. |
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(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
CfnConfigRule(Construct, String, ICfnConfigRuleProps)
public CfnConfigRule(Construct scope, string id, ICfnConfigRuleProps props)
Parameters
- scope Constructs.Construct
Scope in which this resource is defined.
- id System.String
Construct identifier for this resource (unique in its scope).
- props ICfnConfigRuleProps
Resource properties.
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
Compliance type determined by the Config rule.
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
Compliance
Indicates whether an AWS resource or AWS Config rule is compliant and provides the number of contributors that affect the compliance.
public virtual object Compliance { get; set; }
Property Value
System.Object
ConfigRuleName
A name for the AWS Config rule.
public virtual string ConfigRuleName { get; set; }
Property Value
System.String
Description
The description that you provide for the AWS Config rule.
public virtual string Description { get; set; }
Property Value
System.String
EvaluationModes
The modes the AWS Config rule can be evaluated in.
public virtual object EvaluationModes { get; set; }
Property Value
System.Object
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
MaximumExecutionFrequency
The maximum frequency with which AWS Config runs evaluations for a rule.
public virtual string MaximumExecutionFrequency { get; set; }
Property Value
System.String
Scope
Defines which resources can trigger an evaluation for the rule.
public virtual object Scope { get; set; }
Property Value
System.Object
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
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>