Can I add multiple config rules with different resource types in event bridge rule?

0

In the process of creating an event bridge rule, in which will contain multiple AWS Config non-compliant events and sent them to SNS topic or Lambda I want.

The problem and concern is I want to include multiple aws config rules in the same rule. Of course these may contain different resource types, I'm wondering if this is possible or do I have to create a rule for each non-compliant resource

{
  "source": [
    "aws.config"
  ],
  "detail-type": [
    "Config Rules Compliance Change"
  ],
  "detail": {
    "messageType": [
      "ComplianceChangeNotification"
    ],
    "configRuleName": [
      "ec2-security-group-attached-to-eni"
    ],
    "resourceType": [
      "AWS::EC2::SecurityGroup"
    ],
    "newEvaluationResult": {
      "complianceType": [
        "NON_COMPLIANT"
      ]
    }
  }
}

IF I wanted to add s3 public access in here as well, could I just add it in the ConfigRuleName array and then add the complaince Type in the compliance type array? Would that satisfy the requirement?

1 Answer
0

Yes you can add multiple config rules with different resource types in a single EventBridge rule.

This configuration will trigger the EventBridge rule whenever any of the specified config rules detects a non-compliance event for either EC2 security groups or S3 buckets.

{
  "source": [
    "aws.config"
  ],
  "detail-type": [
    "Config Rules Compliance Change"
  ],
  "detail": {
    "messageType": [
      "ComplianceChangeNotification"
    ],
    "configRuleName": [
      "ec2-security-group-attached-to-eni",
      "s3-bucket-public-access-check"
    ],
    "resourceType": [
      "AWS::EC2::SecurityGroup",
      "AWS::S3::Bucket"
    ],
    "newEvaluationResult": {
      "complianceType": [
        "NON_COMPLIANT"
      ]
    }
  }
}
AWS
Swasti
answered a month ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions