generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 274
Closed
Labels
Priority: LowThis issue will not be seen by most users. The issue is a very specific use case or corner caseThis issue will not be seen by most users. The issue is a very specific use case or corner casegood first issueGood for newcomersGood for newcomers
Description
For queue processor mode, the README mentions creating three EventBridge rules, with a target for each:
$ aws events put-rule \
--name MyK8sASGTermRule \
--event-pattern "{\"source\":[\"aws.autoscaling\"],\"detail-type\":[\"EC2 Instance-terminate Lifecycle Action\"]}"
$ aws events put-targets --rule MyK8sASGTermRule \
--targets "Id"="1","Arn"="arn:aws:sqs:us-east-1:123456789012:MyK8sTermQueue"
$ aws events put-rule \
--name MyK8sSpotTermRule \
--event-pattern "{\"source\": [\"aws.ec2\"],\"detail-type\": [\"EC2 Spot Instance Interruption Warning\"]}"
$ aws events put-targets --rule MyK8sSpotTermRule \
--targets "Id"="1","Arn"="arn:aws:sqs:us-east-1:123456789012:MyK8sTermQueue"
$ aws events put-rule \
--name MyK8sRebalanceRule \
--event-pattern "{\"source\": [\"aws.ec2\"],\"detail-type\": [\"EC2 Instance Rebalance Recommendation\"]}"
$ aws events put-targets --rule MyK8sRebalanceRule \
--targets "Id"="1","Arn"="arn:aws:sqs:us-east-1:123456789012:MyK8sTermQueue"
However, the section heading ("Create an Amazon EventBridge Rule") and body copy ("Here is the AWS CLI command to create an Amazon EventBridge rule") are singular. I'm pretty sure a single rule with multiple sources and detail-types would work just fine [1], and it would be simpler to set up.
Example:
$ aws events put-rule \
--name MyK8sNodeTerminationHandlerRule \
--event-pattern '{"source":["aws.autoscaling","aws.ec2"],"detail-type":["EC2 Instance-terminate Lifecycle Action","EC2 Spot Instance Interruption Warning","EC2 Instance Rebalance Recommendation"]}"'
$ aws events put-targets --rule MyK8sNodeTerminationHandlerRule \
--targets "Id"="1","Arn"="arn:aws:sqs:us-east-1:123456789012:MyK8sTermQueue"
[1] Values are OR-ed together: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html.
haugenj and stanvit
Metadata
Metadata
Assignees
Labels
Priority: LowThis issue will not be seen by most users. The issue is a very specific use case or corner caseThis issue will not be seen by most users. The issue is a very specific use case or corner casegood first issueGood for newcomersGood for newcomers