Guide · Amazon DevOps Guru · Notifications

Amazon DevOps Guru Notifications for MCP Servers — SNS Channels, EventBridge Events, and Lambda Handlers

Amazon DevOps Guru delivers notifications through two independent paths: an SNS notification channel (configured via AddNotificationChannel) and EventBridge events (emitted automatically to the account's default event bus with source aws.devops-guru). This guide covers creating an SNS-backed notification channel with severity and message type filters, the SNS topic policy that permits DevOps Guru to publish, the EventBridge event schema for each notification type (new insight, severity upgrade, closed insight, new recommendation), writing a Lambda handler that enriches the event with recommendations before posting to Slack, and using SSM OpsCenter integration for ticket-based incident management. For querying insights programmatically, see Working with Insights. For enabling DevOps Guru and configuring resource coverage, see Resource Collection.

TL;DR

Use AddNotificationChannel to register an SNS topic for push notifications; set Filters.MessageTypes to ["NEW_INSIGHT", "SEVERITY_UPGRADED"] and Filters.Severities to ["HIGH"] to alert only on the most critical events. The SNS topic policy must allow principal devops-guru.amazonaws.com with an aws:SourceAccount condition to prevent cross-account confused-deputy attacks. EventBridge emits events automatically with source aws.devops-guru — no additional configuration is required. The EventBridge path is preferred over SNS for enrichment-based workflows because the Lambda function receives a structured event and can call GetInsight + GetRecommendations before posting to Slack or PagerDuty.

Two notification paths: SNS vs EventBridge

DevOps Guru uses two delivery mechanisms, and they serve different purposes:

SNS notification channel EventBridge
Configuration required Yes — AddNotificationChannel + SNS topic policy No — events are emitted automatically to the default event bus
Payload Human-readable notification text with basic insight metadata Structured JSON with InsightId, InsightType, InsightSeverity, AccountId, Region
Filtering Filter by severity (HIGH/MEDIUM/LOW) and message type Full EventBridge pattern matching on any field in the event
Best for Email notifications to ops team; SMS alerts via SNS subscriptions Lambda handlers that enrich the event (call GetInsight, GetRecommendations) before forwarding to Slack/PagerDuty/OpsGenie
Cross-account SNS topic can be in a different account (with cross-account policy) EventBridge cross-account forwarding requires explicit event bus policy

Use both paths in production: SNS for direct email/SMS alerting to on-call engineers, EventBridge for the enrichment Lambda that creates tickets and posts structured messages to your incident management channel.

SNS notification channel

Step 1: Create the SNS topic and policy

The SNS topic must be in the same region as your DevOps Guru client. The topic policy must explicitly allow devops-guru.amazonaws.com to publish, with an aws:SourceAccount condition to prevent cross-account confused-deputy attacks:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DevOpsGuruPublish",
      "Effect": "Allow",
      "Principal": {
        "Service": "devops-guru.amazonaws.com"
      },
      "Action": "SNS:Publish",
      "Resource": "arn:aws:sns:us-east-1:123456789012:devops-guru-mcp-alerts",
      "Condition": {
        "StringEquals": {
          "aws:SourceAccount": "123456789012"
        }
      }
    }
  ]
}

Gotcha — missing SNS topic policy is the most common AddNotificationChannel failure: If the SNS topic does not have a policy permitting devops-guru.amazonaws.com to publish, AddNotificationChannel succeeds (no error is returned) but DevOps Guru silently drops all notification deliveries. You will not discover this until the first insight fires and no notification arrives. Test by using aws sns publish as a cross-check, then verify the channel is active with ListNotificationChannels.

Step 2: Register the SNS channel

import {
  DevOpsGuruClient,
  AddNotificationChannelCommand,
  ListNotificationChannelsCommand,
  RemoveNotificationChannelCommand,
  type NotificationFilterConfig,
} from "@aws-sdk/client-devops-guru";

const devopsGuru = new DevOpsGuruClient({ region: "us-east-1" });

// Register an SNS topic as a DevOps Guru notification channel.
// MessageTypes controls which events trigger a notification.
// Severities filters to only the specified severity levels.
async function addNotificationChannel(
  topicArn: string
): Promise<string> {
  const filters: NotificationFilterConfig = {
    // Alert on new insights and severity upgrades (e.g., MEDIUM → HIGH)
    MessageTypes: ["NEW_INSIGHT", "SEVERITY_UPGRADED"],
    // Only notify for HIGH-severity insights to reduce alert fatigue.
    // Add "MEDIUM" if you want to know about medium-severity anomalies too.
    Severities: ["HIGH"],
  };

  const { Id } = await devopsGuru.send(
    new AddNotificationChannelCommand({
      Config: {
        Sns: { TopicArn: topicArn },
      },
      Filters: filters,
    })
  );

  console.log("Notification channel registered:", Id);
  return Id!;
}

// List currently registered notification channels.
// Use this to verify the channel was created with the correct config.
async function listNotificationChannels(): Promise<void> {
  let nextToken: string | undefined;

  do {
    const { Channels, NextToken } = await devopsGuru.send(
      new ListNotificationChannelsCommand({ NextToken: nextToken })
    );

    for (const channel of Channels ?? []) {
      console.log("Channel ID:", channel.Id);
      console.log("  SNS ARN:", channel.Config?.Sns?.TopicArn);
      console.log("  Message types:", channel.Filters?.MessageTypes);
      console.log("  Severities:", channel.Filters?.Severities);
    }

    nextToken = NextToken;
  } while (nextToken);
}

// Remove a notification channel by its ID (from AddNotificationChannel response).
async function removeNotificationChannel(channelId: string): Promise<void> {
  await devopsGuru.send(
    new RemoveNotificationChannelCommand({ Id: channelId })
  );
  console.log("Notification channel removed:", channelId);
}

Valid MessageTypes values:

EventBridge events from DevOps Guru

DevOps Guru automatically publishes events to the account's default EventBridge event bus with source aws.devops-guru. No configuration is required to enable this — events are emitted regardless of whether you have an SNS notification channel configured. Create an EventBridge rule to route these events to a Lambda function for enrichment.

EventBridge event structure

// EventBridge event structure for a new DevOps Guru insight.
// The "detail" field contains the insight metadata.
interface DevOpsGuruInsightEvent {
  version: "0";
  id: string;             // EventBridge event ID
  "detail-type":
    | "DevOps Guru New Insight Open"
    | "DevOps Guru Insight Severity Upgraded"
    | "DevOps Guru New Insight Closed"
    | "DevOps Guru New Anomaly Association"
    | "DevOps Guru New Recommendation Created";
  source: "aws.devops-guru";
  account: string;        // AWS account ID
  time: string;           // ISO 8601 timestamp
  region: string;
  detail: {
    insightId: string;
    insightType: "REACTIVE" | "PROACTIVE";
    insightSeverity: "HIGH" | "MEDIUM" | "LOW";
    insightStatus: "ONGOING" | "CLOSED";
    insightName: string;
    insightUrl: string;   // Deep link to the DevOps Guru console
    accountId: string;
    region: string;
    // For SEVERITY_UPGRADED events only:
    previousSeverity?: "HIGH" | "MEDIUM" | "LOW";
  };
}

EventBridge rule: route HIGH-severity insights to Lambda

{
  "source": ["aws.devops-guru"],
  "detail-type": [
    "DevOps Guru New Insight Open",
    "DevOps Guru Insight Severity Upgraded"
  ],
  "detail": {
    "insightSeverity": ["HIGH"]
  }
}

This pattern matches new HIGH-severity insights and severity upgrades to HIGH, while ignoring MEDIUM and LOW events that might create alert fatigue for a small MCP server team.

Lambda handler: enrich and forward to Slack

The Lambda handler pattern for DevOps Guru events calls GetInsight and GetRecommendations to build a rich Slack message with the specific resources affected and the recommended remediation steps:

import {
  DevOpsGuruClient,
  GetInsightCommand,
  GetRecommendationsCommand,
  ListAnomaliesForInsightCommand,
} from "@aws-sdk/client-devops-guru";

const devopsGuru = new DevOpsGuruClient({ region: process.env.AWS_REGION! });

// Lambda event handler for EventBridge DevOps Guru events.
// Environment variables: SLACK_WEBHOOK_URL
export async function handler(event: DevOpsGuruInsightEvent): Promise<void> {
  const { insightId, insightType, insightSeverity, insightUrl } =
    event.detail;

  // Fetch full insight detail including associated resource ARNs.
  const { ReactiveInsight, ProactiveInsight } = await devopsGuru.send(
    new GetInsightCommand({ Id: insightId })
  );
  const insight = ReactiveInsight ?? ProactiveInsight;
  if (!insight) return;

  // Fetch the first page of recommendations.
  const { Recommendations } = await devopsGuru.send(
    new GetRecommendationsCommand({ InsightId: insightId })
  );

  // Find the CAUSAL anomaly (root cause).
  const { ReactiveAnomalies } = await devopsGuru.send(
    new ListAnomaliesForInsightCommand({
      InsightId: insightId,
      MaxResults: 10,
    })
  );
  const causalAnomaly = ReactiveAnomalies?.find((a) => a.Type === "CAUSAL");
  const causalMetrics =
    causalAnomaly?.SourceDetails?.CloudWatchMetrics
      ?.map((m) => `${m.Namespace}/${m.MetricName}`)
      .join(", ") ?? "unknown";

  // Build Slack message.
  const severityEmoji =
    insightSeverity === "HIGH" ? "🔴" : insightSeverity === "MEDIUM" ? "🟡" : "🟢";

  const recommendations = (Recommendations ?? [])
    .slice(0, 3)
    .map((r) => `• ${r.Name}: ${r.Description}`)
    .join("\n");

  const message = {
    text: `${severityEmoji} *DevOps Guru: ${insightSeverity} ${insightType} insight*`,
    blocks: [
      {
        type: "section",
        text: {
          type: "mrkdwn",
          text: [
            `${severityEmoji} *${insight.Name}*`,
            `Severity: ${insightSeverity} | Type: ${insightType}`,
            `Root cause metric: ${causalMetrics}`,
            `Resources: ${insight.AssociatedResourceArns?.join(", ") ?? "unknown"}`,
            "",
            "*Top recommendations:*",
            recommendations || "No recommendations yet.",
            "",
            `<${insightUrl}|View in DevOps Guru console>`,
          ].join("\n"),
        },
      },
    ],
  };

  // Post to Slack.
  await fetch(process.env.SLACK_WEBHOOK_URL!, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(message),
  });
}

Gotcha — Lambda execution role needs devops-guru:GetInsight, devops-guru:GetRecommendations, and devops-guru:ListAnomaliesForInsight: The Lambda function's execution role must have these three permissions. The EventBridge delivery itself does not require DevOps Guru permissions — only the Lambda code that calls back into the DevOps Guru API does.

SSM OpsCenter integration

DevOps Guru can automatically create SSM OpsCenter OpsItems for each new insight, providing a ticket-based incident management workflow without additional Lambda code. Enable this integration with UpdateServiceIntegration:

import {
  UpdateServiceIntegrationCommand,
  DescribeServiceIntegrationCommand,
  OptInStatus,
} from "@aws-sdk/client-devops-guru";

// Enable SSM OpsCenter integration.
// DevOps Guru will automatically create an OpsItem in SSM OpsCenter
// for each new HIGH and MEDIUM severity insight.
async function enableOpsCenterIntegration(): Promise<void> {
  await devopsGuru.send(
    new UpdateServiceIntegrationCommand({
      ServiceIntegration: {
        OpsCenter: {
          OptInStatus: OptInStatus.ENABLED,
        },
      },
    })
  );
  console.log("SSM OpsCenter integration enabled.");
}

// Verify integration status.
async function checkOpsCenterIntegration(): Promise<void> {
  const { ServiceIntegration } = await devopsGuru.send(
    new DescribeServiceIntegrationCommand({})
  );

  console.log(
    "OpsCenter status:",
    ServiceIntegration?.OpsCenter?.OptInStatus
  );
}

When OpsCenter integration is enabled, DevOps Guru creates an OpsItem with:

OpsItems are automatically resolved (status set to Resolved) when DevOps Guru closes the associated insight. This enables a fully automated incident lifecycle: insight opens → OpsItem created → incident investigated → insight closes → OpsItem resolved, without any manual ticket management.

Gotcha — SSM OpsCenter integration requires the AWSServiceRoleForDevOpsGuru role to have OpsCenter permissions: The service-linked role includes permissions for OpsCenter integration. However, if your account uses Service Control Policies (SCPs) that restrict ssm:CreateOpsItem, the OpsCenter integration will silently fail to create items even when configured as ENABLED.

Failure patterns table

Error / symptom Root cause Fix
No SNS notifications received despite ONGOING insight SNS topic policy missing — DevOps Guru silently drops deliveries when it cannot publish to the topic Add "Service": "devops-guru.amazonaws.com" principal with SNS:Publish action and aws:SourceAccount condition to the topic policy
AddNotificationChannel returns success but no channel appears in ListNotificationChannels Eventual consistency — channel registration can take up to 60 seconds to appear Wait 60 seconds and retry ListNotificationChannels
EventBridge rule matches but Lambda receives no events Missing permission on Lambda resource-based policy for EventBridge to invoke the function Add lambda:InvokeFunction permission for principal events.amazonaws.com with aws:SourceArn set to the EventBridge rule ARN
Lambda handler receives NEW_INSIGHT event but AssociatedResourceArns is empty DevOps Guru populates associated resources asynchronously after insight creation; the initial event may arrive before resource correlation completes Add a 30-second wait before calling GetInsight, or retry with exponential backoff until AssociatedResourceArns is populated
SSM OpsItems not created despite OpsCenter integration ENABLED SCP restricts ssm:CreateOpsItem in the account; or insight severity is LOW (OpsCenter only creates items for MEDIUM and HIGH) Check SCP policies for ssm:CreateOpsItem restrictions; confirm insight severity is MEDIUM or HIGH
AccessDeniedException in Lambda when calling DevOps Guru API Lambda execution role missing devops-guru:GetInsight, devops-guru:GetRecommendations, or devops-guru:ListAnomaliesForInsight Add the missing devops-guru actions to the Lambda execution role's IAM policy with Resource: "*"

Putting it all together: complete notification setup

The recommended notification setup for a production MCP server deployment uses all three mechanisms in concert: SNS for direct email alerts to on-call engineers, EventBridge → Lambda for enriched Slack/PagerDuty notifications, and SSM OpsCenter for ticket-based incident tracking.

// Infrastructure-as-code setup (run once at deployment time).
// 1. Create SNS topic with DevOps Guru topic policy.
// 2. Subscribe team email to the SNS topic.
// 3. Register SNS channel with DevOps Guru (HIGH severity only).
// 4. Create EventBridge rule for HIGH-severity new insights.
// 5. Wire EventBridge rule to enrichment Lambda.
// 6. Enable SSM OpsCenter integration.

async function setupDevOpsGuruNotifications(params: {
  snsTopicArn: string;
  lambdaArn: string;
}): Promise<void> {
  const { snsTopicArn } = params;

  // Step 1: Register SNS channel for HIGH severity.
  await devopsGuru.send(
    new AddNotificationChannelCommand({
      Config: { Sns: { TopicArn: snsTopicArn } },
      Filters: {
        MessageTypes: ["NEW_INSIGHT", "SEVERITY_UPGRADED", "CLOSED_INSIGHT"],
        Severities: ["HIGH"],
      },
    })
  );
  console.log("SNS channel registered for HIGH severity alerts.");

  // Step 2: Enable SSM OpsCenter for ticket-based incident tracking.
  await devopsGuru.send(
    new UpdateServiceIntegrationCommand({
      ServiceIntegration: {
        OpsCenter: { OptInStatus: OptInStatus.ENABLED },
      },
    })
  );
  console.log("SSM OpsCenter integration enabled.");

  // Step 3: EventBridge rule is created separately via CloudFormation/CDK.
  // The EventBridge rule routes aws.devops-guru HIGH severity events to the
  // enrichment Lambda. No DevOps Guru API call needed for this — EventBridge
  // events are emitted automatically.
  console.log(
    "EventBridge: create a rule with source aws.devops-guru",
    "and route to enrichment Lambda ARN:", params.lambdaArn
  );
}

Use AliveMCP alerts and DevOps Guru notifications in complementary ways: AliveMCP fires within 60–120 seconds of an external connectivity failure (your MCP server stopped responding to HTTP health checks or MCP protocol pings from outside your VPC); DevOps Guru fires within 5–20 minutes of detecting internal infrastructure anomalies (metric patterns that deviate from baseline, often before external connectivity fails). Together, the two systems cover both the "user-visible impact" dimension (AliveMCP) and the "infrastructure degradation leading indicator" dimension (DevOps Guru).