Unable to set alert name in SNS notification subject for consecutive alerts

Hello together,

I have trouble setting up an SNS contact point, so that the firing alert name appears in the subject correctly for consecutive alerts.

My setup is an AWS managed grafana workspace (grafana v9.4.7) with enabled alerting via an SNS Topic. Delivery of alert messages work.

I am trying to set up the subject field with a template, so that it contains the name(s) of the firing alerts.I tried around alot, and so far I got this:

Alerts: {{ range .Alerts }} {{ .Labels.alertname }} {{ end }}

This results in the following behavior:

  • after I setup the subject, the next time an alert fires (lets call it alert1) it actually works. So I get the subject “Alerts: alert1”
  • From this point on, whenever an alert fires (lets call it alert2) the subject continues to contain the alert name of the first alert that fired since I set the subject. Not the name if the currently firing alert. So it still is “Alert: alert1”, not “Alert: alert2”.
  • When I update the subject field of the contact point, the behavior resets. So the next time an alert fires, it again is the correct alert name but only for one alert, the next is incorrect again.

Any Idea what could cause this behavior? Is my template correct?

Thank you!

Are you sure that AMG has support for SNS notification templates?
Quick google result: Create notification templates - Amazon Managed Grafana - SNS is not mentioned there.

Anyway. It is AMG, so you have support from AWS. Did you try to ask AWS support?