Can we have multiple AWS events or EventBridge partner events in a single event rule

0

I'm looking to create a single event rule and have multiple patterns in it. patterns like ACM Certificate Approaching Expiration & EC2 Instance State-change Notification. if one of the these 2 patterns matches with there corresponding resources then i have target lambda these will perform an action based on some input values from the event.

  1. Suggest me is it good idea to have a single rule and multiple patterns
  2. I know there is a Custom events. Will it help to solve this case
  3. If don't want to prefer this custom events because of cost. Correct me if I'm wrong - AWS default service events Free of cost. whereas Custom events $1.00/million custom events published
2개 답변
1
수락된 답변

Custom events are events that you generate in your application. I am not sure how you want to use custom events in this case. The only way I can think of is to create rules that catch the other, AWS, events, and then create a new custom event. If you do that anyway, why do you need the custom event, not to mention the extra cost and complexity.

You can combine multiple events into a single rule. For instance, the following rule will check if the event is EC2 instance change or ACM certificate expiration:

{
  "source": ["aws.ec2"],
  "detail-type": ["EC2 Instance State-change Notification", "ACM Certificate Approaching Expiration"]
}

You can also have more complex rules such as:

{
  "$or": [
    {
      "detail-type": ["EC2 Instance State-change Notification"],
      "detail": { "state": ["pending"] }
    },
    {
      "detail-type": ["ACM Certificate Approaching Expiration"],
      "detail": { "DaysToExpiry":  [ { "numeric": [ "<", 10 ] } ] }
    }
  ]
}
profile pictureAWS
전문가
Uri
답변함 일 년 전
profile picture
전문가
검토됨 5달 전
1

Yes, it is possible to have multiple patterns in a single event rule using AWS EventBridge. Each pattern can be associated with different event sources or services. In your case, you can create a single event rule with multiple patterns, such as one pattern for ACM Certificate Approaching Expiration and another pattern for EC2 Instance State-change Notification.

By using a single event rule with multiple patterns, you can consolidate the logic and actions within a single rule. This approach can simplify your event handling and reduce the number of separate rules you need to manage.

Regarding Custom Events, they are a feature of EventBridge that allows you to define your own custom events and publish them to the event bus. While Custom Events offer flexibility, they do incur additional costs. AWS default service events, on the other hand, are provided by AWS services and are generally free of cost.

If you prefer to avoid the additional cost associated with Custom Events, you can stick with using the default service events provided by AWS services like ACM and EC2. By combining multiple patterns within a single event rule, you can achieve your desired functionality efficiently.

profile picture
Amol_M
답변함 일 년 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠