AWS SNS integration.
Asked by Dmitry Petriev:

Hi,

We are using the following flow: AWS Managed Prometheus connected to AWS SNS (through Alertmanager configuration), and AWS SNS sent an alert to OpsGenie.

We have rules in AWS Managed Prometheus that send alerts to OpsGenie; integration works well, but we want additional settings:

1) How can we set tags in OpsGenie alerts that depend on triggered rules?

2) How can we close the FIRING alert after getting RESOLVED alert? Now, OpsGenie creates two issues related to the same alert.

I have doubts about this flow because I know that AWS SNS and AWS Managed Prometheus don't have such a flexible setup.


Answers:
author: John M
body: Hi [@Dmitry Petriev](/t5/user/viewprofilepage/user-id/5082037)

Below are answers to your questions:

1**) How can we set tags in OpsGenie alerts that depend on triggered rules?**

You will need to add multiple 'create alert' actions in the integration's advanced settings. Each 'create' action will have its own unique filters that trigger different tags to be added. Here is a screenshot:

![2022-11-17_13-35-21.png](https://community.atlassian.com/t5/image/serverpage/image-id/226389iAD254E8D86FFEF5A/image-size/large?v=v2&px=999 "2022-11-17_13-35-21.png")

**2) How can we close the FIRING alert after getting RESOLVED alert? Now, OpsGenie creates two issues related to the same alert.**

The alias on the close alert will need to match the alias on the payload that created the alert. The [alias field](https://support.atlassian.com/opsgenie/docs/alert-fields/) is what the system uses to match incoming payloads with open alerts, to either [de-duplicate them](https://support.atlassian.com/opsgenie/docs/what-is-alert-de-duplication/) (if they match a 'create alert' action), close them (if they match a 'close alert' action) or complete other actions like 'add note' or 'acknowledge' if the filters match those actions. Keep in mind that incoming payloads are processed against the actions from top to bottom, so if an incoming payload matches a 'create alert' action and there is an open alert with the same alias, it will deduplicate, even if it also matches a 'close' action, because the 'create' actions are processed before close actions - so be sure that your filters are specific and do not broadly match against payloads that they should not be.

![2022-11-17_13-37-27.png](https://community.atlassian.com/t5/image/serverpage/image-id/226388i9FB86159EFA0FBFB/image-size/large?v=v2&px=999 "2022-11-17_13-37-27.png")

comments: author: Dmitry Petriev
body: Wow, actually, I don't have the such panel for settings. Is it available only on a specific subscription plans?


author: John M
body: Hi [@Dmitry Petriev](/t5/user/viewprofilepage/user-id/5082037)

Yes, the advanced settings are available on the Standard and Enterprise plans:

<https://www.atlassian.com/software/opsgenie/pricing>


author: Dmitry Petriev
body: Thanks, John!


author: Pavel Klyuev
body: [@John M](/t5/user/viewprofilepage/user-id/4625213)but AWS Alertmanager doesn't send alias key in message into Amazon SNS and Opsgenie get always unique alias on RESOLVED message because payload doesn't have alias key.

How could we configure auto-close alerts with that integration path: AWS Prometheus rules -\> AWS Alertmanager -\> AWS Amazon SNS -\> Opsgenie incoming integration with Amazon SNS (HTTPS)


author: John M
body: [@Pavel Klyuev](/t5/user/viewprofilepage/user-id/4915261) - You can use any dynamic value or any combination of dynamic values in the alias field - it does not need to contain the {{alias}} value. As long as the incoming payload that created the alert and the payload that will be closing the alert have the same values in those fields, the alert will close. For example, you could use something like the following in the alias fields of both the 'create alert' and 'close alert' actions:

{{subject}} - {{topicArn}}

As long as the above parsed exactly the same on both payloads, it would close the alert. You would want those values to be unique to that individual alert so other alerts are not closing.


Tags: alert

aws

cloud

prometheus