Elastic integration with AWS DevOps Agent: Automated incident response powered by complete context
An Elastic alert started an AWS DevOps Agent investigation 42 seconds after a database connection pool failed, and the agent queried Elastic over MCP to find the cause: host-a had two connections and needed about nine.
Build and observe AI agents where your data already lives. Begin with Elastic Agent Builder. You can also start a free cloud trial or try Elastic on your local machine today.
The integration with AWS DevOps Agent makes Elastic’s rich telemetry and its storage efficiency, along with its broad context, accessible through Elastic Workflows and the Elastic Agent Builder Model Context Protocol (MCP) server. This allows the agent to query Elastic and retrieve additional context as its investigation unfolds, supporting faster, more informed incident investigations. The integration is part of Elastic's broader commitment to an open AI ecosystem, making its telemetry and context available to external agents alongside its own Elastic® nightshift AI SRE offering.
AWS DevOps Agent picked up the incident 42 seconds after we shrank a payment service’s database connection pool from 10 connections to two. Five minutes in, it had a confirmed root cause: host-a’s pool was exhausted and 77% of payments were failing after waiting the full two seconds for a connection. Plus, the service's CPU and memory stayed flat throughout. That last part is what a resource dashboard would have missed. Elastic Observability opened the case, and nobody touched anything after that.
In this example, Elastic Workflows pushes each new case to AWS DevOps Agent with evidence attached, and the agent pulls its own answers back out of Elasticsearch through the Agent Builder MCP server with a read-only key. Elastic is also a partner-managed connector in AWS DevOps Agent, listed under Capability Providers, so you can connect the two from the console or with the scripts in this post. In this blog post, we build both paths in 10 steps, with a sample payment service that you can break on purpose.
What AWS DevOps Agent, Elastic Observability, and Agent Builder each do
AWS DevOps Agent is an AI agent that investigates operational problems across AWS, multicloud, and on-premises environments. You give it an incident, by typing a question into its chat or by sending it an event. It plans an investigation and checks the evidence it can reach, and then it reports findings and a suggested mitigation. Everything it knows about one application lives in an Agent Space, including which AWS accounts it can look at and which tools it can use. It also includes who can see its results. It reaches tools outside AWS through capability providers, which you register on the Capability Providers page of the console. Elastic is one of them, as a partner-managed connector that Elastic publishes and maintains.
Figure 1. Elastic on the AWS DevOps Agent “Capability Providers” page. “Partner-managed” means that Elastic publishes and maintains the connector. The “Register” button starts the console setup described in Step 5.
Elastic Observability collects and stores your telemetry, which is the logs and metrics, as well as traces, that your applications produce. In this post, we use Elastic Cloud Serverless (Serverless), the fully managed version, so there are no clusters to size. Kibana is the web interface where you search that data and build alert rules. It’s also where you track incidents as cases.
Elasticsearch Query Language (ES|QL) is Elastic's query language. A query like Count errors by host for the last 15 minutes is one line of ES|QL. Both the workflow and AWS DevOps Agent use it.
Elastic Agent Builder is a Kibana feature for building AI agents and the tools they use. It also publishes those tools through an MCP server. MCP is an open standard that lets an AI agent in one system call tools in another. Here, it's how AWS DevOps Agent runs searches in Elastic.
Elastic Workflows runs automation inside Kibana. A workflow starts on a trigger, such as a new case, and runs steps: read the case, run an ES|QL query, and call an external service. We use it to send incidents to AWS DevOps Agent.
How telemetry flows from AWS into Elastic Observability
Three collectors carry telemetry into Elastic. AWS DevOps Agent reads it back out through one MCP endpoint, using a read-only key that cannot write or delete:
Figure 2. High-level reference architecture. Telemetry flows into Serverless, and AWS DevOps Agent queries it over MCP.
Starting on the left, your AWS account produces telemetry: AWS CloudTrail records API activity; Amazon Elastic Compute Cloud (Amazon EC2) instances report host metrics; and services such as Amazon Virtual Private Cloud (VPC) flow logs, AWS Web Application Firewall (AWS WAF), Amazon S3 access logs, and Amazon Elastic Block Store (Amazon EBS) produce logs and metrics of their own. Three common collectors carry that data to Elastic. Elastic Agent runs on hosts, and the Elastic Serverless Forwarder (an AWS Lambda function) ships logs. Amazon CloudWatch metric streams sends metrics.
Elastic Nightshift AI SRE offers customers an Elastic-native, cloud-agnostic AI site reliability engineering (SRE) coworker as another option. Elastic is open, flexible, and MCP-enabled, so customers aren’t tied to one agent ecosystem. They can easily integrate and orchestrate other agents, including AWS DevOps Agent, and use them together wherever they bring value.
In the middle, Serverless stores all of it in one place, and the Elastic managed MCP server makes it queryable by an AI agent. On the right, AWS DevOps Agent connects to Agent Builder MCP endpoint over HTTPS and runs queries during an investigation. It turns the results into findings. In a full production setup, that could surface errors clustered on specific EC2 hosts. It could also surface AWS WAF blocks rising at the same time and a pointer to the connection pool. Our walkthrough reproduces the last part with a local sample service: every error on one host, caused by an exhausted database connection pool.
Figure 2 shows AWS DevOps Agent pulling data from Elastic. Figure 3 shows how the agent learns that something is wrong in the first place.
How an Elastic alert starts an AWS DevOps Agent investigation
Figure 3. Reference architecture. The AWS Region shown is an example; this post uses Asia Pacific (Sydney). Amazon EC2 and AWS CloudTrail sources shown are optional and aren’t built in this post. The MCP query path isn’t drawn.
The easiest way to read this diagram is to follow one incident through it.
Everything starts with telemetry (1). In production, that could be the Amazon EC2 metrics and AWS CloudTrail logs shown in the diagram. In this post, it's a small payment service running on your own computer as two "hosts," which are local processes on 127.0.0.1. It sends its logs, metrics, and traces straight to Elasticsearch (2) over HTTPS, so none of this telemetry passes through your AWS account. Your AWS account holds only the Agent Space, which reads the telemetry back from Elastic during an investigation. Elastic machine learning (3) can watch that data for anomalies.
A Kibana alert rule (4) checks the data every minute; for example, an SRE engineer intends to ask a question, like, Does any host have more than 50 payment-service errors in the last 5 minutes? When the answer is yes, the rule raises an alert (5) and opens a case within Elastic.
The new case starts a workflow in Elastic Workflows (6). The workflow reads the case and runs two quick ES|QL queries to gather evidence (errors by host, plus the most common error messages). It packages everything into an incident. A Kibana HTTP connector (7) holds the AWS DevOps Agent webhook address and its secret token, so neither appears in the workflow itself. The connector posts the incident to AWS DevOps Agent (8).
AWS DevOps Agent creates an incident and starts investigating (9). This is where Figure 2 comes back in. While it investigates, AWS DevOps Agent calls the Agent Builder MCP server and runs its own queries, including which hosts are failing and what the traces show, along with when the errors began. That's what lets it point out that "host-a's connection pool is too small" instead of repeating the alert text back to you. Automated remediation (10) is possible but out of scope. Here, a human approves any fix.
Across the figures 2 and 3, traffic runs both ways: Elastic pushes incidents out, and AWS DevOps Agent pulls telemetry back.
Elastic to AWS DevOps Agent (push) | AWS DevOps Agent to Elastic (pull) | |
|---|---|---|
Trigger | New Elastic case | Agent decision during investigation |
Transport | Kibana HTTP connector to generic webhook | Agent Builder MCP server over HTTPS |
Auth | Bearer token, encrypted secret header | Read-only API key, 30-day expiry |
Carries | Case metadata, plus two ES|QL evidence queries | Logs, metrics, traces, alerts, ES|QL results |
Infrastructure to deploy | None | None |
Prerequisites for the AWS DevOps Agent and Elastic integration
AWS prerequisites
AWS account.
A Region where AWS DevOps Agent is available. In this post, we use Asia Pacific - Sydney
ap-southeast-2. (See AWS DevOps Agent supported Regions.)An AWS Identity and Access Management (IAM) principle that can deploy AWS CloudFormation stacks, create IAM roles and pass them to
aidevops.amazonaws.com, and manage AWS DevOps Agent resources, including MCP server registration.AWS Command Line Interface (AWS CLI) version 2, configured for that account (running
aws sts get-caller-identitysucceeds).
Elastic Observability prerequisites
An Elastic Cloud Serverless Observability project on the Complete tier (Agent Builder and Elastic Workflows aren’t available on the Logs Essentials tier).
A Kibana user with permissions to create API keys, connectors, rules, cases, and workflows.
Local environment prerequisites
macOS or Linux with
bash,curl,git, and Python 3.11 or later (tested with 3.13).
Region, data residency, and feature status
Regions and data location. The Elastic project and the Agent Space can be in different Regions; our setup uses us-west-2 for Elastic and ap-southeast-2 for the Agent Space. AWS DevOps Agent stores investigation data, including the Elastic data that its tool calls return, in the Agent Space Region, so choose that Region according to your data residency requirements. Whether you register Elastic with the script or the console connector, the agent's queries go to your Elastic project's endpoint, which Elastic operates, so those requests leave the Agent Space Region when the two Regions differ.
Feature status: Currently, the
cases.caseCreatedworkflow trigger is in technical preview on Serverless. Elastic Workflows is generally available (GA).
What AWS DevOps Agent and Serverless cost to run this
AWS DevOps Agent bills for each second that an agent actively works on an investigation or chat; idle time isn’t billed. New customers may receive a free trial. Each investigation in this post took about four to eight minutes of wall-clock time, from start to completion. Billing counts only the agent's active working time, which can be lower; the operator web app's Incidents page shows the total investigation time that you've used. (See AWS DevOps Agent pricing for current rates.)
AWS CloudFormation stacks and the IAM roles in this post have no charge.
Serverless bills for ingest and retention. The load generator sends 12 HTTP requests per second (six per host).
Connect AWS DevOps Agent to Elastic Observability in 10 steps
Step 1: Get the code, and create the .env file
git clone https://github.com/aws-samples/aws-generativeai-partner-samples.git
cd aws-generativeai-partner-samples/elastic/integrations/elastic-devops-agent-integration
cp .env.example .env
chmod 600 .envRun every command in this post from that folder.
Every script reads its settings from .env. Open it, and fill in your Elastic addresses. In Kibana, the Kibana and Elasticsearch URLs are under Help > Connection details, and the OpenTelemetry Protocol (OTLP) endpoint is under Add data > Applications > OpenTelemetry. The MCP URL is your Kibana URL, followed by /api/agent_builder/mcp. Leave the keys empty for now. (See an example configuration in the git repo.)
NOTE: Don't leave angle-bracket placeholders, like <project>, in this file. The scripts load it with the shell, and the shell reads < as a redirect.
Step 2: Create the three Elastic API keys
Our walkthrough uses three Elastic API keys, each with one job, so that a leaked key can only do a little damage.
.env variable | Purpose | Used by |
|---|---|---|
| Creates and removes the connector, workflow, rule, case template, and audit index | Setup, check, and cleanup scripts |
| Sends telemetry to the managed OTLP endpoint |
|
| Read-only access for AWS DevOps Agent and for telemetry checks | AWS DevOps Agent and |
Create all three while you're signed in to Kibana. Elasticsearch won't let one API key create another key that has privileges, so a script can't do this for you.
Setup key. Open Admin and settings > API keys > Create API key. Name it
aws-devops-agent-setup, and set it to expire in one day. Leave privileges unrestricted so it inherits yours. Paste it into.envasELASTIC_ADMIN_API_KEY.Ingest key. Click on Home. Open Add data > Connect Directly To Endpoint > OpenTelemetry, and create a key for the OTLP endpoint. Paste it in as
OTLP_API_KEY. For more details, follow the documentation here.Read-only key for the agent. Open Developer Tools > Console, paste the request below (it's also in
elastic-config/security/mcp-readonly-api-key.json), and then run it. Take the contents of this file and paste as shown below.
Run the following request in Developer Tools > Console:
POST /_security/api_key
{ REPLACE the contents of elastic-config/security/mcp-readonly-api-key.json file here}Copy the encoded value into .env as ELASTIC_MCP_API_KEY. This key can read logs, metrics, traces, and alerts, and it can use Agent Builder tools. It can't write or delete anything, and it expires after 30 days. Check that the key works with the MCP server:
set -a; source .env; set +a
curl -s -X POST "$MCP_URL" \
-H "Authorization: ApiKey $ELASTIC_MCP_API_KEY" \
-H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' |
python3 -I -c 'import json,sys; print(len(json.load(sys.stdin)["result"]["tools"]), "tools")'In our test, the command printed 54 tools. The endpoint lists every tool, regardless of key privileges; a write request with this key returned HTTP 403.
Step 3: Create the AWS DevOps Agent Space
Run ./scripts/01-deploy-agent-space.sh. This deploys infra/agent-space.yaml with CloudFormation. It creates the Agent Space, turns on the operator web app, links your AWS account so the agent can look at it, and creates two IAM roles. One role lets the agent read your account, using the AWS managed policy AIDevOpsAgentAccessPolicy. The other is for the operator web app, using AIDevOpsOperatorAppAccessPolicy.
When it finishes, copy the AgentSpaceId from the output into .env as AGENT_SPACE_ID.
Figure 4. The new Agent Space. “Launch via IAM” opens the operator web app, which you use in Step 6.
Step 4: Run the sample service, and send telemetry to Elastic
payment-service is a FastAPI application with a SQLAlchemy connection pool. Elastic Distribution of OpenTelemetry (EDOT) Python exports its traces and logs, as well as its metrics, to the managed OTLP endpoint with OTLP_API_KEY. The script starts two instances (payments-host-a and payments-host-b) on 127.0.0.1 and a load generator. Run ./scripts/run-local.sh start.
This starts two copies of payment-service, called payments-host-a and payments-host-b, plus a small load generator that sends six payments per second to each. Both listen only on your computer (127.0.0.1). EDOT sends their logs and metrics to Elastic, along with their traces.
Wait two minutes, and then, to check that data is arriving, run ./scripts/verify-telemetry.sh 15.
You should see requests on both hosts, no failures, and no rows under Errors by host. You can see the same data in Kibana with a one-line ES|QL query in Discover:
FROM logs-* | WHERE service.name == "payment-service" | STATS count = COUNT(*) BY host.name, severity_textFigure 5. Kibana Discover ES|QL query counting payment-service logs by host for payments-host-a and payments-host-b.
The service has a switch for breaking itself. ./scripts/run-local.sh fault shrinks host-a's database connection pool from 10 connections to two and makes each payment hold its connection for 1.5 seconds. Payments start queuing, and most fail with HTTP 503 errors, while the service’s process CPU and memory stay flat. This matters, because it means that the problem won't show up as a resource spike. (The sample sends process metrics only, not host metrics.) ./scripts/run-local.sh heal puts things back. The switch has no authentication, so keep it on 127.0.0.1.
Step 5: Register the Elastic MCP server with AWS DevOps Agent
Run ./scripts/05-register-elastic-mcp.sh. The script prints Allowing 12 tools. It deploys infra/elastic-mcp.yaml (see here), which registers the Elastic MCP server with AWS DevOps Agent, using your read-only key in the Authorization header, and attaches that server to your Agent Space with a list of allowed tools. Here’s the part of the template that registers the server:
ElasticMcpServer:
Type: AWS::DevOpsAgent::ServiceThe key is a hidden (NoEcho) parameter, so CloudFormation doesn't show it in the console. The script does pass it on the command line, so run it on a computer that only you use.
By default, the agent gets these 12 read-only tools:
Tool | What the agent uses it for |
|---|---|
| Search and summarize logs |
| Look at requests as they move through the service |
| List hosts and their metrics |
| List services and their health |
| Read active alerts |
| Spot sudden changes in log volume |
| Spot sudden changes in metrics |
| Run ES|QL queries |
| Turn a question into ES|QL |
| Search an index |
| See what data exists |
| Read field names and types |
In the console, open your Agent Space and choose the Capabilities tab. The MCP Server section should list elastic with 54 available / 12 connected. The server offers 54 tools, and Agent Space is allowed to use 12 of them.
If you register through the console instead (below), the server appears in the Telemetry section.
Figure 6. The Elastic MCP server is attached to the Agent Space, with 12 of its 54 tools allowed.
If you prefer, you can register Elastic from the AWS DevOps Agent console with the partner-managed connector shown in Figure 3, instead of running the script. On the Capability Providers page, choose Register on the Elastic card. Enter a short name (12 characters or fewer, because AWS DevOps Agent puts the name in front of every tool name and caps each one at 64 characters). Then, enter your Kibana project alias, its Region, and the read-only key from Step 2; the console adds the ApiKey prefix for you. Next, in your Agent Space, open Capabilities, choose Add in the Telemetry section, and select the same 12 tools from the table above as Read only. The console can also install skills that Elastic recommends for investigations. When you save, it shows Set up alert webhook. Keep that URL and token for Step 7. Use the console or the script, not both, because both would claim the same server name and the Agent Space's single API key webhook. (See Using partner-managed connectors for the full steps.)
Step 6: Ask AWS DevOps Agent a question about your Elastic data
Before you automate anything, check that the agent can actually use Elastic. Break the service, and wait 10 minutes so there's something to find. Simply run ./scripts/run-local.sh fault.
In the AWS DevOps Agent console, go to Agent spaces, find your Agent Space, and choose Launch via IAM to open the operator web app. Choose New chat, and paste this:
Investigate errors in payment-service over the last 30 minutes. Use Elastic to identify the affected hosts and common error messages, then compare CPU and memory for those hosts.Distinguish observations from hypotheses and recommend the next diagnostic step.Figure 7. The agent's answer, with a table of errors by host.
The agent first says what it's going to do: pull payment-service errors from Elastic for the 30-minute window and compare CPU and memory, keeping what the data shows separate from what it's guessing. The line 18 tools · 1 agent used is a collapsed list of the Elastic queries it ran. Expand it to see each one.
The agent got it right. Every error traced back to payments-host-a running out of database connections:
payments-host-a logged 6,846 errors in the 30-minute window, 100% of the total and 77% of its own log lines.
payments-host-b logged none.
Process-level CPU and memory weren't elevated on host-a, which points away from resource pressure on the service and toward its configuration. The sample doesn't send host metrics, so the agent couldn't check the host itself.
That’s exactly the fault we injected.
When the chat finishes, run ./scripts/run-local.sh heal to fix the service so that the alert rule in Step 8 doesn't fire straight away.
Step 7: Create the webhook in AWS DevOps Agent
A webhook is an address that another system can post events to. This is where Elastic sends incidents.
If you registered Elastic from the console in Step 5, you already have one. Skip the numbered steps below, and use the URL and token from Set up alert webhook. Put the URL in .env as DEVOPS_AGENT_WEBHOOK_URL, and only the token that follows Bearer as DEVOPS_AGENT_WEBHOOK_TOKEN, because the Kibana HTTP connector in Step 8 adds the Bearer prefix itself. If you used the script, create the webhook as follows:
In the AWS DevOps Agent console, open your Agent Space.
On the Capabilities tab, find Webhook and choose Configure.
Choose Add webhook.
For Webhook authentication type, choose API key and create it.
Copy the webhook URL and token into
.envasDEVOPS_AGENT_WEBHOOK_URLandDEVOPS_AGENT_WEBHOOK_TOKEN.
The console shows the token only once. If you lose it, rotate the webhook (Actions > Edit > Rotate webhook). The URL stays the same, and you update the token in .env and run the Step 8 script again.
Figure 8. Rotating the webhook. The URL has the form https://event-ai.<region>.api.aws/webhook/generic/<id> and doesn't change; the new credentials can be downloaded once as a .csv file.
Step 8: Create the Elastic alert rule, connector, and workflow
Run ./scripts/06-setup-elastic-alerting.sh. This creates five things in Elastic. You can run it again any time to apply changes.
An audit index,
devops-agent-notifications, which stores a copy of every incident sent.An HTTP connector,
AWS DevOps Agent HTTP, which holds the webhook URL and the token. Kibana encrypts the token as a secret header, so it never appears in the workflow.A case template that gives new cases a
highseverity. Without it, cases opened by a rule start aslow, and the agent would treat them as low priority.An alert rule,
payment-service error spike, that runs every minute and fires when any host logs more than 50 errors in five minutes. It opens one case per problem and adds later alerts to the same case for seven days.The workflow,
AWS DevOps Agent - Case Notification.
Figure 9. Kibana Connectors page showing the AWS DevOps Agent HTTP connector used by Elastic Workflows.
The rule is a single ES|QL query:
FROM logs-* | WHERE service.name == "payment-service" AND severity_text == "ERROR" | STATS errors = COUNT(*) BY host.name | WHERE errors > 50The workflow is the heart of the push path. The full file is elastic-config/workflows/case-to-devops-agent.yaml (see here). Note that:
The workflow runs on every new Observability case but forwards only cases tagged aws-devops-agent; other cases stop after the first step. The rule's case template adds the tag, so rule-created cases always qualify.
AWS DevOps Agent needs five fields:
eventType,incidentId,action,priority, andtitle.prioritymust beCRITICAL,HIGH,MEDIUM,LOW, orMINIMAL. If you send anything else, the webhook still answers HTTP 200, but no investigation starts. That one can take a while to spot, which is what the audit index is for.{{ }}turns a value into text, while${{ }}passes it through as is. That's how the same payload object is both saved and sent.The evidence queries cover every service in the project, so the agent also hears about errors next door. To narrow them to one service, add
AND service.name == "payment-service"to both queries.
Step 9: Test the handoff from an Elastic case to AWS DevOps Agent
This test checks the path from a case to an investigation. Turn the rule off first, so it doesn't open its own case while you're testing.
In Kibana, open Observability > Alerts > Manage rules, and disable
payment-service error spike.Break the service, and wait five minutes:
./scripts/run-local.sh faultOpen Observability > Cases > Create case. Call it
payment-service errors on payments-host-a, set Severity to High, add the tags aws-devops-agent and e2e-test, and create it. The workflow forwards only cases tagged aws-devops-agent; e2e-test lets the cleanup script remove the case later.Run
./scripts/check-chain.shto see each hop, or check in Kibana. Under Workflows >AWS DevOps Agent - Case Notification> Executions, all eight steps should be green, and the case should have a comment that startsForwarded to AWS DevOps Agent.
Figure 10. Elastic Workflows execution history.
5. In the operator web app, open Incidents. You should see a HIGH priority incident with your case's title.
In our test, run before the tag check was added, Elastic created the case at 19:05:27.7 UTC, and the workflow started two seconds later. All seven steps took about two seconds, and the call to AWS DevOps Agent took 923 milliseconds. AWS DevOps Agent created the incident at 19:05:31.4, about four seconds after the case, and the investigation finished about 7.5 minutes later.
When it's done, fix the service with ./scripts/run-local.sh heal and close the case.
Step 10: Test the whole chain from an Elastic alert
Now the real thing, with no human in the loop between the failure and the investigation. Make sure that no workshop case is still open, because the rule adds new alerts to an open case instead of starting a new one. Then, turn the rule back on.
scenario.sh restarts both hosts and runs a few minutes of healthy traffic. It then breaks host-a. It keeps running in the foreground, so start it in a second terminal:
HEALTHY_MIN=5 FAULT_MIN=15 ./scripts/scenario.shHere's what happened in our run, with nobody touching anything after the script started:
Time (UTC) | What happened | Time since the failure |
|---|---|---|
22:56:45 |
| 0 seconds |
22:57:20 | The rule opens a high-severity case | 35 seconds |
22:57:25 | The workflow starts and logs the incident | 40 seconds |
22:57:27 | AWS DevOps Agent creates a HIGH priority incident | 42 seconds |
22:57:41 | The investigation starts | 56 seconds |
23:01:49 | The investigation is complete | about 5 minutes |
Figure 11. Elastic Observability case auto-created by the alert rule.
Figure 12. The operator web app's “Incidents” page. The top row is the investigation the alert started; “Triggered By: Event Channel” means it came in through the webhook. The “Linked” row is a second test incident that AWS DevOps Agent attached to an open investigation of the same problem. The page also shows how much investigation time you've used.
If an investigation of the same problem is still open when a new incident arrives, AWS DevOps Agent links the new one to it (status Linked) instead of starting over. We saw this during testing.
When you're finished, run ./scripts/run-local.sh heal. The fault stays on after the script ends.
What did AWS DevOps Agent find in the Elastic telemetry?
In the automated run, AWS DevOps Agent used seven of its 12 Elastic tools, with no errors, and platform_core_execute_esql was the one that it used most. Its findings matched what we had broken:
About 77% of payments on host-a were failing after waiting the full two seconds for a database connection. Host-b had no errors and answered in about 31 milliseconds.
Each query held a connection for about 1.5 seconds. With only two connections, host-a could handle about 1.3 payments per second, but about 5.9 were arriving.
Thread counts and in-flight requests were rising, which pointed to requests queueing for the pool rather than extra load.
The root cause was a change to host-a's connection pool settings, and the agent wrote a mitigation plan to restore them, marked for an engineer to review before running.
Figure 13. The investigation summary. The tabs across the top hold the full timeline (including each Elastic query), the root cause analysis, the mitigation plan, and a review page.
The summary in Figure 13 goes a step further than the chat in Step 6. It marks the root cause as Confirmed and names the exact moment and mechanism: a call to /admin/fault at 22:56:45 UTC switched host-a into pool_exhaustion mode. It also noticed that the same fault had run earlier in the day, and its proposed mitigation goes beyond turning the fault off. It suggests requiring authentication on /admin/fault and alerting on fault mode changed, which is good advice for any real service with a switch like that. It still couldn't report host-level CPU and memory, because the sample sends process metrics only.
Troubleshooting the AWS DevOps Agent and Elastic integration
For troubleshooting, refer to the resource here.
Remove the Agent Space, Elastic workflow, and API keys
1. In the Agent Space Capabilities tab, under Webhook, choose Actions > Remove. CloudFormation didn't create the webhook, so it won't remove it.
If you registered Elastic from the console in Step 5, remove that registration yourself, because the teardown script manages only its CloudFormation stacks. In the Agent Space's Capabilities tab, select the Elastic server in the Telemetry section and choose Remove. This also removes any recommended skills that you installed with it. Then, on the Capability Providers page, under Currently registered, choose View all on the Elastic card, select your registration, and then choose Actions > Deregister.
2. See what the teardown script will delete. By default, it only lists things:
./scripts/99-teardown.sh3. The teardown script deletes only the two stacks named by STACK_NAME and MCP_STACK_NAME in your .env, by exact name, so it never touches other stacks that share a prefix or tag. Check the plan it prints, and then delete:
./scripts/99-teardown.sh --yes --purge-telemetry4. This removes the MCP registration and the Agent Space with its IAM roles; the Elastic workflow, rule, connector, case template, audit index, and workshop cases; the sample service's data in Elastic; and the local processes and files.
5. Revoke the Elastic API keys. In Kibana Developer Tools > Console:
DELETE /_security/api_key
{ "name": "aws-devops-agent-mcp-readonly" }
DELETE /_security/api_key
{ "name": "aws-devops-agent-setup" }6. Delete the ingest key in Admin and settings > API keys.
7. Delete .env. It holds your keys and the webhook token.
What to try next with AWS DevOps Agent and Elastic Observability
With this setup, by the time the on-call engineer has found their laptop, AWS DevOps Agent already knows which host is failing, what the errors say, when the problem started, and what to try first. In our test, this took about five minutes from the moment the service broke. The engineer starts by reviewing a plan instead of building one from scratch.
Two connections make that possible, and you now have both. Elastic Workflows hands each new Elastic case to AWS DevOps Agent with evidence attached, and the Agent Builder MCP server lets the agent ask Elastic its own questions. A read-only key and a 12-tool allowlist keep it from changing anything.
Try it on one real service next. Pick a service that already sends telemetry to Elastic. Point a copy of the alert rule at it, and let AWS DevOps Agent investigate its next real alert alongside your on-call engineer. Compare its findings with what the engineer finds, and adjust from there.
From there, a few things will make the agent sharper:
Give it host metrics. Add the OpenTelemetry host metrics receiver so it can rule CPU and memory in or out.
Write custom Agent Builder tools. Turn the ES|QL queries that your team trusts into named tools, so the agent uses the same checks every time.
Install Elastic's recommended skills. When you add the Elastic connector to an Agent Space, the console offers skills that Elastic publishes for investigations, such as elastic-sre-triage and elastic-service-reliability. Skills teach the agent how to use Elastic's tools during an investigation. (For the full list, see the Elastic connector page.)
Add the rest of the diagram. Amazon EC2 and AWS CloudTrail rules plug into the same workflow. For resources not created with CloudFormation, set up an AWS Resource Explorer aggregator index in the Agent Space Region so the agent can map them.
For more details, read the AWS DevOps Agent user guide and the documentation for the Elastic Agent Builder MCP server and Elastic Workflows. If you build on this, we'd like to hear what your agent finds. Open an issue on the sample’s repository.
How helpful was this content?




