aws-cdk-lib.aws_config.CustomRuleProps

interface CustomRuleProps

LanguageType name
.NETAmazon.CDK.AWS.Config.CustomRuleProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsconfig#CustomRuleProps
Javasoftware.amazon.awscdk.services.config.CustomRuleProps
Pythonaws_cdk.aws_config.CustomRuleProps
TypeScript (source)aws-cdk-lib » aws_config » CustomRuleProps

Construction properties for a CustomRule.

Example

// Lambda function containing logic that evaluates compliance with the rule.
const evalComplianceFn = new lambda.Function(this, "CustomFunction", {
  code: lambda.AssetCode.fromInline(
    "exports.handler = (event) => console.log(event);"
  ),
  handler: "index.handler",
  runtime: lambda.Runtime.NODEJS_18_X,
});

// A custom rule that runs on configuration changes of EC2 instances
const customRule = new config.CustomRule(this, "Custom", {
  configurationChanges: true,
  lambdaFunction: evalComplianceFn,
  ruleScope: config.RuleScope.fromResource(config.ResourceType.EC2_INSTANCE),
});

Properties

NameTypeDescription
lambdaFunctionIFunctionThe Lambda function to run.
configRuleName?stringA name for the AWS Config rule.
configurationChanges?booleanWhether to run the rule on configuration changes.
description?stringA description about this AWS Config rule.
inputParameters?{ [string]: any }Input parameter values that are passed to the AWS Config rule.
maximumExecutionFrequency?MaximumExecutionFrequencyThe maximum frequency at which the AWS Config rule runs evaluations.
periodic?booleanWhether to run the rule on a fixed frequency.
ruleScope?RuleScopeDefines which resources trigger an evaluation for an AWS Config rule.

lambdaFunction

Type: IFunction

The Lambda function to run.


configRuleName?

Type: string (optional, default: CloudFormation generated name)

A name for the AWS Config rule.


configurationChanges?

Type: boolean (optional, default: false)

Whether to run the rule on configuration changes.


description?

Type: string (optional, default: No description)

A description about this AWS Config rule.


inputParameters?

Type: { [string]: any } (optional, default: No input parameters)

Input parameter values that are passed to the AWS Config rule.


maximumExecutionFrequency?

Type: MaximumExecutionFrequency (optional, default: MaximumExecutionFrequency.TWENTY_FOUR_HOURS)

The maximum frequency at which the AWS Config rule runs evaluations.


periodic?

Type: boolean (optional, default: false)

Whether to run the rule on a fixed frequency.


ruleScope?

Type: RuleScope (optional, default: evaluations for the rule are triggered when any resource in the recording group changes.)

Defines which resources trigger an evaluation for an AWS Config rule.