amazon web services - How to create a CloudWatch alarm for an EventBridge Pipe's stopped state in AWS? - Stack Overflow
- c - Solaris 10 make Error code 1 Fatal Error when trying to build python 2.7.16 - Stack Overflow 推荐度:
- javascript - How to dismiss a phonegap notification programmatically - Stack Overflow 推荐度:
- javascript - Get the JSON objects that are not present in another array - Stack Overflow 推荐度:
- javascript - VS 2015 Angular 2 import modules cannot be resolved - Stack Overflow 推荐度:
- javascript - Type 'undefined' is not assignable to type 'menuItemProps[]' - Stack Overflow 推荐度:
- 相关推荐
I am working with AWS EventBridge Pipes using Terraform, and I want to create a CloudWatch alarm that notifies me whenever a pipe transitions to the Stopped state. However, I encountered an issue since EventBridge Pipes do not seem to have a built-in CloudWatch metric like PipeState.
- I don't have CloudWatch logs for pipes due to project requirements.
- In AWS console > CloudTrail > Event History, I can see an event with the name "StopPipe" when a pipe is stopped. The event source is "pipes.amazonaws", and the resource type is "AWS::Pipes::Pipe".
I have tried setting up the following resources using Terraform:
- A CloudWatch Event Rule to capture the StopPipe event from CloudTrail.
- An SNS Topic for notifications.
- A CloudWatch Metric Alarm to trigger when the event is detected.
Problem: When the pipe is stopped, the CloudWatch alarm is not firing, StopPipe event is visible in CloudTrail > event history.
I need help with where I might be going wrong or if there's a different approach I should consider. Any guidance would be much appreciated!
Code:
# Resource: CloudWatch Event Rule to capture StopPipe event from CloudTrail
resource "aws_cloudwatch_event_rule" "pipe_stop_status_rule" {
name = "pipe-stop-status-rule"
description = "CloudWatch rule to capture StopPipe events from CloudTrail"
event_pattern = jsonencode({
"source" = ["pipes.amazonaws"],
"detail-type" = ["AWS API Call via CloudTrail"],
"detail" = {
"eventName" = ["StopPipe"]
}
})
}
# Resource: CloudWatch Event Target to send the event to SNS
resource "aws_cloudwatch_event_target" "pipe_stop_event_target" {
rule = aws_cloudwatch_event_rule.pipe_stop_status_rule.name
target_id = "sns-target"
arn = aws_sns_topic.pipe_alarm_topic.arn
}
# Resource: SNS Topic for Notifications
resource "aws_sns_topic" "pipe_alarm_topic" {
name = "pipe-stopped-alarm-topic"
}
# Resource: SNS Topic Subscription (Email)
resource "aws_sns_topic_subscription" "email_subscription" {
topic_arn = aws_sns_topic.pipe_alarm_topic.arn
protocol = "email"
endpoint = "[email protected]" # Replace with your email
}
# Resource: CloudWatch Alarm for monitoring StopPipe events
resource "aws_cloudwatch_metric_alarm" "pipe_stop_alarm" {
alarm_name = "pipe-stop-status"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = 1
metric_name = "StopPipeEventDetected"
namespace = "Custom/EventBridgePipes"
period = 60
statistic = "Sum"
threshold = 1
alarm_description = "Triggers when a StopPipe event is detected"
actions_enabled = true
alarm_actions = [
aws_sns_topic.pipe_alarm_topic.arn
]
}
最新文章
- Windows 10盗版不易?所以在中国普及速度极慢
- 3Q大战2012版打起来了
- linux - How to use GNU ld with rustc-compiled obj file without cargo? - Stack Overflow
- ios - AccessorySetupKit picker doesn't show accessory unless previously paired in Setting app first - Stack Overflow
- OpenAI Assistant: File Search tool stops working when I enable custom function calling - Stack Overflow
- starknet - How to generate and verify a STARK proof from a Cairo program locally? - Stack Overflow
- rust - Why is the compiler asking for Sized, when I already added it? - Stack Overflow
- amazon web services - Problem with eventbridge when scheduling a rule - Stack Overflow
- c# - Add button to DetailRowTemplate in Blazorise DataGrid - Stack Overflow
- python - Unable to Fetch Data from PostgreSQL on Databricks - Connection Attempt Failed - Stack Overflow
- Blender Python Script isn't positioning meshes right from the image - Stack Overflow
- utf 8 - correct way to Import database dump in PowerShell - Stack Overflow
- javascript - Use HTML5 canvas 2d API with WebGL - Stack Overflow
- pine script - Is there a way to incorporate dynamic commission fees in the TradingView Strategy Tester? - Stack Overflow
- ios - Display videos in React Native does not work in production mode but in Simulator [expo-media-libraryexpo-av] - Stack Overf
- flutter - How to write LOGs in an APP made in fletpython, which appear in the DDMS? - Stack Overflow
- applescript - How do I interact with the macOS share sheet? - Stack Overflow