Skip to main content

Integrating CloudWatch Alarms with PagerDuty and Slack


This guide will show you how to link your AWS CloudWatch alarms through to PagerDuty and Slack.

1. Create an SNS topic

In your application infrastructure code in the environments repository, create an SNS topic.

2. Create alarms

In your application infrastructure code in the environments repository, create your CloudWatch alarms based on the monitoring you require.

We recommend only creating alarms for things which need action, if you create too many alarms the alerting becomes noisy and ends up being ignored.

Configure your alarms to notify your SNS topic created in step 1.

3. Create a PagerDuty service

  1. In the Modernisation Platform repository create a PagerDuty service here

  2. Copy the top section of code to create a pagerduty_service, pagerduty_service_integration and pagerduty_slack_connection if you want to connect you pager duty service to a slack channel for your application.

  3. Add the pagerduty_service_integration integration key here

  4. Raise a PR for approval by the Modernisation Platform terraform.

Add the following code to your application infrastructure in the modernisation platform environments repository, replacing as appropriate, a full example can be seen here

# Pager duty integration

# Get the map of pagerduty integration keys from the modernisation platform account
data "aws_secretsmanager_secret" "pagerduty_integration_keys" {
  provider = aws.modernisation-platform
  name     = "pagerduty_integration_keys"
data "aws_secretsmanager_secret_version" "pagerduty_integration_keys" {
  provider  = aws.modernisation-platform
  secret_id =

# Add a local to get the keys
locals {
  pagerduty_integration_keys = jsondecode(data.aws_secretsmanager_secret_version.pagerduty_integration_keys.secret_string)

# link the sns topic to the service
module "pagerduty_core_alerts" {
  depends_on = [
    aws_sns_topic.<my sns topic>
  source                    = ""
  sns_topics                = [aws_sns_topic.<my sns topic>.name]
  pagerduty_integration_key = local.pagerduty_integration_keys["<my integration key name>"]
This page was last reviewed on 20 June 2023. It needs to be reviewed again on 20 December 2023 by the page owner #modernisation-platform .
This page was set to be reviewed before 20 December 2023 by the page owner #modernisation-platform. This might mean the content is out of date.