Class CustomRuleProps
Construction properties for a CustomRule.
Inheritance
Namespace: Amazon.CDK.AWS.Config
Assembly: Amazon.CDK.AWS.Config.dll
Syntax (csharp)
public class CustomRuleProps : Object, ICustomRuleProps, IRuleProps
Syntax (vb)
Public Class CustomRuleProps
Inherits Object
Implements ICustomRuleProps, IRuleProps
Remarks
ExampleMetadata: infused
Examples
// Lambda function containing logic that evaluates compliance with the rule.
var evalComplianceFn = new Function(this, "CustomFunction", new FunctionProps {
Code = AssetCode.FromInline("exports.handler = (event) => console.log(event);"),
Handler = "index.handler",
Runtime = Runtime.NODEJS_14_X
});
// A custom rule that runs on configuration changes of EC2 instances
var customRule = new CustomRule(this, "Custom", new CustomRuleProps {
ConfigurationChanges = true,
LambdaFunction = evalComplianceFn,
RuleScope = RuleScope.FromResource(ResourceType.EC2_INSTANCE)
});
// A rule to detect stack drifts
var driftRule = new CloudFormationStackDriftDetectionCheck(this, "Drift");
// Topic to which compliance notification events will be published
var complianceTopic = new Topic(this, "ComplianceTopic");
// Send notification on compliance change events
driftRule.OnComplianceChange("ComplianceChange", new OnEventOptions {
Target = new SnsTopic(complianceTopic)
});
Synopsis
Constructors
CustomRuleProps() |
Properties
ConfigRuleName | A name for the AWS Config rule. |
ConfigurationChanges | Whether to run the rule on configuration changes. |
Description | A description about this AWS Config rule. |
InputParameters | Input parameter values that are passed to the AWS Config rule. |
LambdaFunction | The Lambda function to run. |
MaximumExecutionFrequency | The maximum frequency at which the AWS Config rule runs evaluations. |
Periodic | Whether to run the rule on a fixed frequency. |
RuleScope | Defines which resources trigger an evaluation for an AWS Config rule. |
Constructors
CustomRuleProps()
public CustomRuleProps()
Properties
ConfigRuleName
A name for the AWS Config rule.
public string ConfigRuleName { get; set; }
Property Value
System.String
Remarks
Default: - CloudFormation generated name
ConfigurationChanges
Whether to run the rule on configuration changes.
public Nullable<bool> ConfigurationChanges { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
Description
A description about this AWS Config rule.
public string Description { get; set; }
Property Value
System.String
Remarks
Default: - No description
InputParameters
Input parameter values that are passed to the AWS Config rule.
public IDictionary<string, object> InputParameters { get; set; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Remarks
Default: - No input parameters
LambdaFunction
MaximumExecutionFrequency
The maximum frequency at which the AWS Config rule runs evaluations.
public Nullable<MaximumExecutionFrequency> MaximumExecutionFrequency { get; set; }
Property Value
System.Nullable<MaximumExecutionFrequency>
Remarks
Default: MaximumExecutionFrequency.TWENTY_FOUR_HOURS
Periodic
Whether to run the rule on a fixed frequency.
public Nullable<bool> Periodic { get; set; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
RuleScope
Defines which resources trigger an evaluation for an AWS Config rule.
public RuleScope RuleScope { get; set; }
Property Value
Remarks
Default: - evaluations for the rule are triggered when any resource in the recording group changes.