向不同地区的SNS发出CloudWatch警报 [英] CloudWatch alarm to SNS in different region

查看:85
本文介绍了向不同地区的SNS发出CloudWatch警报的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图通过位于不同区域的CloudWatch警报通知SNS主题。原因是我想要SMS警报,而该警报在我的服务所在的地区不可用。如果输入订阅的ARN并将更改保存在控制台中,则会收到保存警报时出错。请重试。重试无济于事。在本地区域使用主题确实可以,但是那不是我所需要的。

I'm trying to notify an SNS topic from a CloudWatch alarm that's in a different region. The reason is that I want SMS alerting, which isn't available in the region where my services are. If I enter the ARN of the subscription and save the changes in the console, I get "There was an error saving the alarm. Please try again." Trying again does not help. Using a topic in the local region does work, but that's not what I need.

有没有办法通知其他区域的主题?如果没有,还有其他简单的方法可以实现我的目标吗?

Is there a way to notify a topic in a different region? If not, is there another easy way I can achieve my goal?

推荐答案

找不到任何明确表明可以做到这一点的文档尚未完成,但是尝试使用CLI在 eu-west-1 中从 us-east-1 设置SNS作为警报操作,我得到了:

Didn't find any docs that explicitly say this can't be done but tried to set an SNS from us-east-1 as an action of an alarm in eu-west-1 using the CLI and I got this:

An error occurred (ValidationError) when calling the PutMetricAlarm operation: Invalid region us-east-1 specified. Only eu-west-1 is supported.

所以我认为它不受支持。

So I'll assume it's not supported.

要获得所需的功能,可以使用AWS Lambda。可以说您的服务位于不支持SMS的区域,我将以 eu-central-1 为例。

To get the functionality you need you can use AWS Lambda. Lets say your service is in a region where SMS is not supported, I'll use eu-central-1 as an example.

设置会这样:


  1. [ us-east-1 ]创建可以发送SMS消息的SNS主题

  2. [ eu-central-1 创建一个lambda函数,该函数将消息从该区域的步骤1发送到SNS主题。

  3. [ eu-central-1 ]在您的服务所在的区域中创建一个SNS主题。
    对于SNS主题,使用AWS Lambda协议配置预订,并将其指向步骤2中的lambda。

  4. [ eu-central-1 ]创建您的在您的服务所在的区域发出警报,并将第3步中的SNS主题作为操作。

  1. [us-east-1] Create your SNS topic that can send SMS messages, in the region where SMS is supported.
  2. [eu-central-1 Create a lambda function that sends messages to the SNS topic from step 1 in the region where your service is.
  3. [eu-central-1] Create an SNS topic in the region where your service is. For the SNS topic configure subscription with AWS Lambda protocol and point it to lambda from step 2.
  4. [eu-central-1] Create your alarm in the region where your service is and put the SNS topic from step 3 as an action.

这篇关于向不同地区的SNS发出CloudWatch警报的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆