Skip to content

Setting Up Real-Time Budget Alerts for AWS DevOps Agent Usage

12 minute read
Content level: Intermediate
0

AWS DevOps Agent charges per agent-second with no built-in spending cap or alert mechanism. This article walks through setting up a CloudWatch metric math alarm that sums daily consumption across all task types (investigations, evaluations, chat, on-demand) and sends an SNS notification when usage exceeds your defined budget threshold. Includes console steps, CLI commands, and a ready-to-deploy CloudFormation template.

Authors - Sagar Gandha (Sr. Technical Account Manager) , Manish Mishra (Sr. Technical Account Manager)

AWS DevOps Agent charges $0.0083 per agent-second ($0.498 per agent-minute) for all operational tasks — investigations, evaluations, on-demand tasks via chat, and custom agents. Without proactive monitoring, usage costs can accumulate quickly during periods of high activity.

This article shows how to set up a CloudWatch alarm that alerts you when daily DevOps Agent consumption approaches or exceeds a budget threshold you define, so your team can make informed decisions about usage and spending. For broader cost monitoring strategies including AWS Budgets and Cost Explorer, see How do I monitor and control AWS DevOps Agent costs?. This article focuses specifically on real-time alerting using CloudWatch metrics published by the service.

Multi-region note: This article covers a per-space, single-region CloudWatch alarm. If you have agent spaces across multiple AWS regions, consider the account-level Lambda-based approach (Template 1) which automatically discovers and aggregates usage across all regions where DevOps Agent is available (us-east-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, ap-southeast-2, ap-northeast-1). For large-scale deployments with many agent spaces, set the Lambda timeout to 300 seconds and memory to 256 MB to accommodate multi-region discovery and metric queries.

The Problem

AWS DevOps Agent usage is consumption-based, and there is no built-in mechanism to cap usage or alert when spending reaches a particular level. Any user with access can trigger investigations, evaluations, chat sessions, or on-demand tasks. Complex investigations can run 10–15 minutes each, and costs accumulate quickly during periods of high activity.

What you need: A real-time daily budget alarm that sums all DevOps Agent consumption metrics (investigations, evaluations, chat, and on-demand tasks) and alerts the operations team when usage exceeds a threshold you define.

Note: Customers on paid AWS Support plans receive monthly DevOps Agent credits that offset charges. Teams on Enterprise Support, Unified Operations, or Business Support+ plans should review their credit allocation and plan their threshold accordingly. For details on credit rates, see AWS DevOps Agent Pricing.

Solution Architecture

┌───────────────────────────────────────────────────────────────┐
│ CloudWatch Metric Math Alarm                                  │
│                                                               │
│  m1: ConsumedInvestigationTime (Sum, 24hr)                    │
│  m2: ConsumedEvaluationTime    (Sum, 24hr)                    │
│  m3: ConsumedChatTime          (Sum, 24hr)                    │
│  m4: ConsumedOnDemandTime      (Sum, 24hr)                    │
│                                                               │
│  e1 = m1 + m2 + m3 + m4  →  "CombinedConsumedTime"            │
│                                                               │
│  Threshold: e1 > Your daily budget threshold in seconds       │
│                                                               │
│  Action: SNS → Team notification (email/Slack/PagerDuty)      │
└───────────────────────────────────────────────────────────────┘

The alarm uses CloudWatch metric math to combine four metrics published by DevOps Agent under the AWS/AIDevOps namespace, evaluates the sum against a daily budget threshold you configure, and triggers an SNS notification when exceeded.

Pricing Reference

All three DevOps Agent task types are charged at the same rate (source):

Task TypeRate
Investigations (Incident Response)$0.0083 per agent-second
Evaluations (Incident Prevention)$0.0083 per agent-second
On-demand tasks (Chat and Custom Agents)$0.0083 per agent-second

Key pricing facts (see AWS DevOps Agent Pricing for current rates):

  • No upfront commitments or charges when the agent is idle
  • Agent time is the cumulative time the agent spends actively working across all activities for a given task
  • An 8-minute investigation costs approximately $3.98
  • A team running 80 investigations per month at 8 minutes each spends approximately $318.72 per month
  • Credits are issued by the 10th of each month, apply to charges within that month, and expire at month-end

Note: Customers on paid AWS Support plans (Enterprise Support, Unified Operations, Business Support+) receive monthly credits that offset DevOps Agent charges. Review your support plan to understand your credit allocation and factor this into your budget planning.

How to Calculate Your Daily Threshold

Determine a daily budget in agent-seconds based on your organization's usage goals and pricing:

Daily threshold (seconds) = Monthly budget ($) ÷ 30 days ÷ $0.0083 per second

The following table provides example thresholds at various monthly budget levels:

Monthly BudgetDaily Threshold (seconds)Approx. Investigations/day (@ 8 min avg)
$3001,205~2.5
$7503,012~6
$3,00012,048~25
$7,50030,120~63
$37,500150,602~314

Tip: Teams on AWS Support plans should factor in their monthly credit allocation when choosing a threshold. Enterprise Support, Unified Operations, and Business Support+ each provide different credit levels — review your plan details and adjust accordingly.

Prerequisites

1. Service-Linked Role

The AWSServiceRoleForAIDevOps role must exist for metrics to be published. For agent spaces created before March 13, 2026, create it manually:

aws iam create-service-linked-role --aws-service-name devops-agent.amazonaws.com

2. Agent Space UUID

Find it in the DevOps Agent Admin Console under your Agent Space settings, or extract from the agent space ARN.

3. At Least One Agent Activity

CloudWatch only displays the AWS/AIDevOps namespace after at least one investigation, evaluation, chat, or on-demand task has occurred. Each metric type publishes only after that specific task type runs at least once:

MetricAppears After
ConsumedInvestigationTimeFirst investigation completes
ConsumedEvaluationTimeFirst evaluation completes
ConsumedChatTimeFirst chat session completes
ConsumedOnDemandTimeFirst on-demand/custom agent task completes

Run a quick investigation or chat if metrics don't appear.

Manual Setup Steps (AWS Console)

Step 1: Create an SNS Topic

  1. Go to Amazon SNS ConsoleTopicsCreate topic
  2. Type: Standard
  3. Name: devops-agent-budget-alerts
  4. Click Create topic
  5. Click Create subscription
    • Protocol: Email
    • Endpoint: your team email address
  6. Click Create subscription
  7. Check email and confirm the subscription
  8. Copy the Topic ARN for later use

Step 2: Create the CloudWatch Alarm

Important: The CloudWatch console only shows metrics that have received data. If you don't see AWS/AIDevOps in the metric browser, use the CLI method below instead — it works even without existing metric data.

If metrics are visible in the console:

  1. Go to CloudWatch ConsoleAlarmsCreate alarm
  2. Click Select metric → search for AWS/AIDevOps
  3. Click AgentSpaceUUID dimension
  4. Select ConsumedInvestigationTime → click Select metric
  5. In the Graphed metrics tab:
    • Click Add metric and repeat for ConsumedEvaluationTime, ConsumedChatTime, and ConsumedOnDemandTime
    • Set Statistic = Sum and Period = 1 Day for each metric
  6. Click Add a math expression → enter: m1 + m2 + m3 + m4
  7. Set label to CombinedConsumedTime
  8. Uncheck m1, m2, m3, m4 from alarming (only the expression should alarm)
  9. Click Select metric
  10. Threshold: Greater than → enter your daily budget threshold in seconds (e.g., 3012 for a ~$750/month budget)
  11. Click Next
  12. Notification: Select your SNS topic devops-agent-budget-alerts
  13. Click Next
  14. Name: AIDevOps-CombinedConsumedTime-Budget--<YOUR-SPACE-UUID>
  15. Description: Alerts when daily AWS DevOps Agent consumption exceeds configured budget threshold
  16. Click Create alarm

If metrics are NOT yet visible (recommended approach):

Use AWS CloudShell or CLI. Replace YOUR_ACCOUNT_ID and YOUR-SPACE-UUID:

aws cloudwatch put-metric-alarm \
  --region us-east-1 \
  --alarm-name "AIDevOps-CombinedConsumedTime-Budget" \
  --alarm-description "Daily budget alarm - alerts when DevOps Agent usage exceeds configured threshold" \
  --actions-enabled \
  --alarm-actions "arn:aws:sns:us-east-1:YOUR_ACCOUNT_ID:devops-agent-budget-alerts" \
  --evaluation-periods 1 \
  --comparison-operator GreaterThanThreshold \
  --threshold 3012 \
  --treat-missing-data notBreaching \
  --metrics '[{"Id":"m1","MetricStat":{"Metric":{"Namespace":"AWS/AIDevOps","MetricName":"ConsumedInvestigationTime","Dimensions":[{"Name":"AgentSpaceUUID","Value":"YOUR-SPACE-UUID"}]},"Period":86400,"Stat":"Sum"},"ReturnData":false},{"Id":"m2","MetricStat":{"Metric":{"Namespace":"AWS/AIDevOps","MetricName":"ConsumedEvaluationTime","Dimensions":[{"Name":"AgentSpaceUUID","Value":"YOUR-SPACE-UUID"}]},"Period":86400,"Stat":"Sum"},"ReturnData":false},{"Id":"m3","MetricStat":{"Metric":{"Namespace":"AWS/AIDevOps","MetricName":"ConsumedChatTime","Dimensions":[{"Name":"AgentSpaceUUID","Value":"YOUR-SPACE-UUID"}]},"Period":86400,"Stat":"Sum"},"ReturnData":false},{"Id":"m4","MetricStat":{"Metric":{"Namespace":"AWS/AIDevOps","MetricName":"ConsumedOnDemandTime","Dimensions":[{"Name":"AgentSpaceUUID","Value":"YOUR-SPACE-UUID"}]},"Period":86400,"Stat":"Sum"},"ReturnData":false},{"Id":"e1","Expression":"m1 + m2 + m3 + m4","Label":"CombinedConsumedTime","ReturnData":true}]'

Step 3: Verify the Alarm

  1. Go to CloudWatchAlarms → find your alarm
  2. State should be OK or Insufficient data (both are expected initially)
  3. Click into the alarm to verify the math expression, threshold, and SNS action
  4. Test SNS by publishing a test message from the SNS Console

Step 4: Enable Chat (if disabled on existing Agent Spaces)

If chat is disabled, you need to update Agent Space permissions:

Option A: Go to DevOps Agent Admin Console → Actions → Disable Operator Access → Re-enable with "Auto-create a new AWS DevOps Agent role."

Option B: Add these IAM permissions to your operator role:

  • aidevops:ListChats
  • aidevops:CreateChat
  • aidevops:SendMessage

CloudFormation Template

Important: This is a sample CloudFormation template provided as a starting point. Customers should validate, test, and enhance it based on their specific requirements, security policies, and operational needs before deploying to production environments.

Deploy this template to create the complete alarm setup. Customize the parameters for your environment.

AWSTemplateFormatVersion: '2010-09-09'
Description: >
  Real-time daily budget alarm for AWS DevOps Agent.
  Alerts when combined daily consumption (investigations + evaluations + chat + on-demand)
  exceeds your configured budget threshold.
  NOTE: This is a sample template. Customers should validate and enhance based on their needs.

Parameters:
  AgentSpaceUUID:
    Type: String
    Description: >
      UUID of the DevOps Agent Space. Find it in the DevOps Agent Admin Console
      under Agent Space settings, or extract from the agent space ARN.

  DailyBudgetSeconds:
    Type: Number
    Default: 3012
    Description: >
      Daily threshold in agent-seconds based on your organization's budget.
      Calculate as: Monthly budget ($) / 30 / 0.0083.
      Adjust based on your usage goals and pricing requirements.

  NotificationEmail:
    Type: String
    Description: Email address for budget alert notifications.

  AlarmPrefix:
    Type: String
    Default: AIDevOps
    Description: Prefix for resource names.

Resources:
  # SNS Topic for notifications
  BudgetAlertTopic:
    Type: AWS::SNS::Topic
    Properties:
      TopicName: !Sub '${AlarmPrefix}-budget-alerts'
      DisplayName: DevOps Agent Budget Alerts

  # Email subscription
  BudgetAlertSubscription:
    Type: AWS::SNS::Subscription
    Properties:
      TopicArn: !Ref BudgetAlertTopic
      Protocol: email
      Endpoint: !Ref NotificationEmail

  # CloudWatch Alarm with metric math
  DevOpsAgentBudgetAlarm:
    Type: AWS::CloudWatch::Alarm
    Properties:
      AlarmName: !Sub '${AlarmPrefix}-CombinedConsumedTime-Budget--${AgentSpaceUUID}'
      AlarmDescription: !Sub >
        Alerts when daily AWS DevOps Agent consumption exceeds ${DailyBudgetSeconds}
        agent-seconds. Review usage patterns and adjust threshold based on your
        organization's budget and pricing requirements.
      ActionsEnabled: true
      AlarmActions:
        - !Ref BudgetAlertTopic
      OKActions:
        - !Ref BudgetAlertTopic
      EvaluationPeriods: 1
      ComparisonOperator: GreaterThanThreshold
      Threshold: !Ref DailyBudgetSeconds
      TreatMissingData: notBreaching
      Metrics:
        - Id: m1
          MetricStat:
            Metric:
              Namespace: AWS/AIDevOps
              MetricName: ConsumedInvestigationTime
              Dimensions:
                - Name: AgentSpaceUUID
                  Value: !Ref AgentSpaceUUID
            Period: 86400
            Stat: Sum
          ReturnData: false
        - Id: m2
          MetricStat:
            Metric:
              Namespace: AWS/AIDevOps
              MetricName: ConsumedEvaluationTime
              Dimensions:
                - Name: AgentSpaceUUID
                  Value: !Ref AgentSpaceUUID
            Period: 86400
            Stat: Sum
          ReturnData: false
        - Id: m3
          MetricStat:
            Metric:
              Namespace: AWS/AIDevOps
              MetricName: ConsumedChatTime
              Dimensions:
                - Name: AgentSpaceUUID
                  Value: !Ref AgentSpaceUUID
            Period: 86400
            Stat: Sum
          ReturnData: false
        - Id: m4
          MetricStat:
            Metric:
              Namespace: AWS/AIDevOps
              MetricName: ConsumedOnDemandTime
              Dimensions:
                - Name: AgentSpaceUUID
                  Value: !Ref AgentSpaceUUID
            Period: 86400
            Stat: Sum
          ReturnData: false
        - Id: e1
          Expression: m1 + m2 + m3 + m4
          Label: CombinedConsumedTime
          ReturnData: true

Outputs:
  AlarmArn:
    Description: ARN of the budget alarm
    Value: !GetAtt DevOpsAgentBudgetAlarm.Arn

  SNSTopicArn:
    Description: ARN of the SNS notification topic
    Value: !Ref BudgetAlertTopic

  DailyBudgetInfo:
    Description: Budget configuration summary
    Value: !Sub 'Daily threshold: ${DailyBudgetSeconds} seconds'

Deploy the CloudFormation Template

Console:

  1. Go to CloudFormation ConsoleCreate stackWith new resources
  2. Upload the template file
  3. Fill in parameters:
    • AgentSpaceUUID: Your agent space UUID
    • DailyBudgetSeconds: Your calculated threshold
    • NotificationEmail: Your team email
  4. Click through and Create stack
  5. Confirm the SNS email subscription when it arrives

CLI:

aws cloudformation create-stack \
  --stack-name devops-agent-budget-alarm \
  --template-body file://devops-agent-budget-alarm.yaml \
  --parameters \
    ParameterKey=AgentSpaceUUID,ParameterValue=YOUR-SPACE-UUID \
    ParameterKey=DailyBudgetSeconds,ParameterValue=3012 \
    ParameterKey=NotificationEmail,ParameterValue=cloudops@yourcompany.com

Complementary Controls

This alarm is one layer of a layered cost management strategy:

ControlPurposeHow to Set Up
This alarm (CloudWatch)Real-time daily consumption alertThis article
AWS BudgetsMonthly cost tracking and forecastingBudgets Console, filter by "AWS DevOps Agent"
GetAccountUsage APIProgrammatic usage checkaws devops-agent get-account-usage
Cost ExplorerTrend analysis and spike detectionFilter by Service = AWS DevOps Agent
IAM role scopingLimit which users can trigger investigationsRestrict aidevops:* actions per role
Evaluation frequencyReduce proactive evaluation cadenceAgent Space settings

Limitations

  • Does not stop investigations — the alarm only alerts. There is no built-in mechanism to auto-terminate running tasks.
  • Does not cover indirect costs — CloudWatch Logs Insights queries, X-Ray trace retrievals, and similar services are billed separately.
  • Does not aggregate across agent spaces — create one alarm per space, or use metric math to sum across spaces.
  • Metrics appear only after first use — each metric type (investigation, evaluation, chat, on-demand) publishes only after that task type runs at least once.
  • Threshold is configurable, not prescriptive — choose a threshold that aligns with your organization's usage goals, budget, and pricing model.

Troubleshooting

IssueCauseSolution
AWS/AIDevOps namespace not visibleNo agent activity has occurredRun an investigation, then wait 5–10 minutes
Only ConsumedInvestigationTime appearsOnly investigations have been usedUse chat, run an evaluation, and trigger an on-demand/custom agent task to populate all metrics
Chat is disabled in Agent SpaceMissing IAM permissionsRe-enable operator access or add aidevops:ListChats, CreateChat, SendMessage permissions
Alarm stuck in "Insufficient data"No metric data in the 24-hour evaluation periodNormal state when agent is idle; will resolve when activity occurs
Cannot run evaluationNo completed investigation in target periodComplete an investigation first, then run evaluation

Related Information