Skip to content

Add aws-db-connectivity-pathtrace skill (find the hop that breaks a database connection) - #334

Draft
vgaglia-aws wants to merge 2 commits into
aws:mainfrom
vgaglia-aws:add-aws-db-connectivity-pathtrace
Draft

vgaglia-aws wants to merge 2 commits into
aws:mainfrom
vgaglia-aws:add-aws-db-connectivity-pathtrace

Conversation

@vgaglia-aws

@vgaglia-aws vgaglia-aws commented Dec 3, 2026 •

Copy link
Copy Markdown

Description

Tool request: #339.

This PR adds aws-db-connectivity-pathtrace, a read-only skill for a client that cannot connect to an Amazon RDS, Aurora, DocumentDB or DynamoDB endpoint: a timeout, a refused connection, a TLS or DNS failure, or an error code the database server sends back. It has the agent read the configuration along the path from that client to the endpoint through read-only control-plane calls, walk the path hop by hop, name the first hop that blocks with a severity and the specific fix, and write a Markdown report.

What it covers

  • Engines: Aurora (MySQL and PostgreSQL), RDS (MySQL, PostgreSQL, MariaDB, SQL Server and Oracle), Amazon DocumentDB, and DynamoDB through VPC endpoints.
  • Where it starts: the verbatim client error, looked up in an index of MySQL errors, PostgreSQL SQLSTATEs and DocumentDB client errors, or a symptom-to-hop table when the user has only a symptom. The index covers TLS enforcement too: the PostgreSQL no pg_hba.conf entry message from a client without SSL points first to rds.force_ssl, and MySQL ERROR 3159 to require_secure_transport. It finds the endpoint and the client with describe calls when the user has not named them, and asks only for what the control plane cannot show, such as the exact error text or an on-premises CIDR.
  • Before any hop fails: it stops at a state check when the database is not available, reading the cluster status and the status of each member instance for Aurora and DocumentDB, matches managed events (failover, reboot, scaling, patching, maintenance) against the onset, and checks a list of known false signals.
  • The hops, in order: sessions the server rejected, where an engine error code proves the network good (the grant host pattern, IAM database authentication, and which connection limit was hit); RDS Proxy (the four security-group rules, the Secrets Manager grant, target-group state, pinning); security groups; network ACLs and the ephemeral return range; route tables in both directions; subnet placement and PubliclyAccessible; DNS attributes and endpoint choice, including reader-endpoint caching; VPC endpoints for DynamoDB; and TLS (the CA bundle for the instance's CACertificateIdentifier, and the RDS for Oracle SSL option port and wallet).
  • DynamoDB through a gateway endpoint: besides the endpoint, its route-table association and its policy, it checks the client's security-group egress to the DynamoDB prefix list on port 443 and the client subnet's network ACL on 443 and the ephemeral return range. It says when a client behind VPC peering, a transit gateway, a VPN, Direct Connect or on premises needs an interface endpoint instead.
  • Fixes that depend on the engine: raising max_connections is immediate relief on MySQL and Aurora MySQL, since on PostgreSQL and Aurora PostgreSQL the change needs a reboot. Whether a cipher or TLS-version parameter can be changed is read from the parameter group (IsModifiable) rather than assumed.
  • When no hop is clearly blocking: it works through causes the control plane cannot see (client firewall, intermediary idle timeout, source-address rewriting, client-side timeouts, packet size, application crashes, client crypto policy), each with the check that settles it. Then it recommends a VPC Reachability Analyzer analysis for a person to run and reads the result.
  • Review mode: a proactive check of the same path for every RDS, Aurora and DocumentDB target (public accessibility against intent, subnet-group coverage, security-group and network ACL shape, DNS attributes, CA certificate currency, connection headroom, endpoint hygiene, DynamoDB gateway endpoints), with recommended alarms.
  • Report: db-connectivity-trace-<endpoint>-<YYYY-MM-DD>.md from assets/report-template.md, with a verdict per hop, a Fix line for every FAIL or UNKNOWN hop and an escalation-readiness packet.

SKILL.md holds the workflow, a five-step checklist that says when each step runs and what it produces, and the severity definitions. The hop conditions, lookup tables and fix templates are in references/REFERENCE.md, and a reference map before the workflow in SKILL.md says which section to load for which step.

How it differs from existing skills

  • network-log-analyzer works from traffic evidence: VPC Flow Logs, REJECT records and packet captures. It checks the configuration to confirm a cause seen in that traffic. Its README lists a database timeout among its example prompts. My skill walks the configuration on the path to one database endpoint, starting from the driver error with no traffic evidence, and never queries flow logs. It hands off to network-log-analyzer by name when the user brings flow logs or a packet capture, when a hop stays UNKNOWN and only traffic evidence can settle it, and for connection failures to any other destination.
  • database-rds-devops runs predefined health-check queries inside Aurora MySQL and Aurora PostgreSQL through the RDS Data API, with the rds-aidba MCP server, and its own workflow for "Too many connections" errors checks the DatabaseConnections metric and CloudWatch Logs, then runs two of those queries (current connections against the maximum, and thread sources). My skill needs no MCP server and never connects to the database: for a connection-limit error such as MySQL ERROR 1040 it compares the same metric with the instance's own max_connections, read from its parameter group or taken as the engine default for its instance class.
  • rds-operation-review reviews RDS and Aurora against the Well-Architected Framework and best practices, including security posture, backups and encryption. Its review also checks public access, security groups, subnet groups and connection headroom, as my review mode does, and both recommend alarms. My review mode adds network ACL return ranges, VPC DNS attributes, CA certificate currency, subnet IDs that no longer resolve, endpoint hygiene and DynamoDB gateway endpoints, and it also reviews DocumentDB clusters. In incident mode my skill starts from one client that cannot connect; my review mode checks the same path for every RDS, Aurora and DocumentDB target, checks the public-accessibility posture against intent, and reports an over-broad security group rule as LOW hygiene. My skill routes a security-posture review (exposure, 0.0.0.0/0 on the database port, public accessibility, encryption, IAM, audit logging, backups) to another skill: my description says "not a posture audit", and two of my should-not-trigger cases ask for one.
  • aws-vpc-dns-investigation observes name resolution live from inside a subnet through its MCP server and simulates DNS changes before they are applied. My skill's DNS hop reads the control plane: the VPC DNS attributes, whether the client uses the right endpoint, and private hosted zones. For reader-endpoint caching it names a dig command that reads the live TTL rather than quoting a figure. It does not hand off to that skill.
  • aws-routing explains which path AWS picks and why, across Transit Gateway, Direct Connect, Cloud WAN and BGP, and also covers VPC route tables, peering routes and asymmetric return paths. My skill's route-table hop checks that the client subnet has a route to the database subnet (local, a peering connection, a transit gateway, or a virtual private gateway for VPN or Direct Connect), that the peering connection is active or the transit gateway attachment available, and that the database subnet routes back. It checks that these routes exist for one client and one database, and does not work out which path AWS prefers.
  • aws-systems-manager lists the AWS-owned runbook AWSSupport-TroubleshootConnectivityToRDS (read-only), which a person starts after the agent prepares it. The runbook takes an EC2 instance and an RDS DB instance, checks that the database is available, and evaluates their security groups, network ACLs and route tables. My skill also takes a Lambda function or an on-premises network as the client, and checks RDS Proxy, DNS, TLS, DynamoDB VPC endpoints and sessions the server rejects, none of which is among the runbook's steps. It starts no automation. aws-systems-manager also lists a second read-only runbook, AWSSupport-ValidateRdsNetworkConfiguration, which helps prevent an RDS, Aurora or DocumentDB instance from being marked incompatible-network before a modify or start operation; my review mode checks one cause of that state, a subnet ID in the subnet group that no longer resolves.
  • database-migration-service-expertise troubleshoots DMS task failures, including network errors between a replication instance and its source or target endpoint. Its checklist asks whether the endpoint is reachable from the DMS VPC, whether security groups allow the database port and whether the subnet network ACLs allow DMS traffic. For a network timeout it checks the connection test results (aws dms test-connection, describe-connections) and the replication instance's security groups, and names security groups, routing or DNS as the cause; it has no route-table or DNS step. My skill has no DMS-specific step (DMS appears nowhere in its SKILL.md, REFERENCE.md or README).
  • Open pull requests that add database skills: feat: Add database-rds-resilience and database-rds-security skills #54 and feat: Add 4 Aurora engine-behavior skills (parameter, replication, upgrade, lifecycle) #58 (RDS and Aurora resilience, security and engine behavior), Add rds-upgrade-advisor skill #133 (RDS upgrades), RDS Well Architected Review Skill #271 (an RDS Well-Architected review), Add PostgreSQL DBA skill #288 (PostgreSQL diagnostics inside the database through postgresql-dba-mcp, which is already on main), and feat: add dynamodb-data-health-inspection skill #94 and feat: add dynamodb-latency skill #96 (DynamoDB data health and latency). Going by their titles, and for Add PostgreSQL DBA skill #288 its skill description, none of them traces the network path to a database; feat(skills): add aws-elasticache-devops skill #197 (an ElastiCache troubleshooting skill) and the open issue Amazon ElastiCache troubleshooting skill #191 that asks for one are out of scope, since my skill does not cover ElastiCache.

I searched the skills on main, the custom agents, the MCP servers, the open pull requests and the open issues. The two RDS and Aurora MCP servers on main, rds-aidba and postgresql-dba-mcp, run queries inside the database (aws-redshift-mcp-server does the same for Amazon Redshift, which my skill does not cover), and no custom agent or open issue is about database connectivity.

Read-only posture and IAM

The skill only reads and only recommends. It changes no security group, network ACL, route, DNS setting or database, and it never connects to the database itself. When the user asks the agent to apply a fix, or asks whether it can, SKILL.md lines 44 to 48 tell it to answer that the trace only recommends: it gives the precise fix for the user to apply (the resource ID, the rule or setting and the exact change) and does not apply it or offer to, with or without approval. For VPC Reachability Analyzer it recommends an analysis for a person to run and reads the result with DescribeNetworkInsightsPaths and DescribeNetworkInsightsAnalyses; it never calls create-network-insights-path or start-network-insights-analysis. automation/iam-policy.json lists the 34 read actions the skill calls (STS, RDS, Lambda, EC2, Route 53 and CloudWatch metrics) in 6 statements, with no CloudWatch Logs or flow-log read. Two of them, ec2:DescribePrefixLists and ec2:DescribeManagedPrefixLists, read the DynamoDB prefix list: its CIDRs for the network ACL rules and its ID for the security-group rule. 33 of the 34 are in the AIDevOpsAgentAccessPolicy managed policy (v16, 2026-11-14); the other is sts:GetCallerIdentity, which needs no IAM permission (the STS API reference says none is required, even under an explicit deny). automation/README.md explains each statement.

Type of change

  • New skill
  • New custom agent
  • New MCP server
  • Update to an existing skill, agent, or MCP server
  • Documentation or infrastructure change

Required before review

  • Repository layout is correct — skills in /skills, MCP servers in /mcp, custom agents in /custom-agents; skills and MCP servers are never mixed in one directory. Here: one directory, skills/aws-db-connectivity-pathtrace/.
  • A domain SME has reviewed and signed off. A named subject-matter expert for this domain — someone other than the author — has reviewed the tool for technical correctness and approved it in this PR. Required for any change to what the tool tells the agent; an edit that changes no technical claim can be marked n/a with the reason, as CONTRIBUTING.md describes. Here: not yet.
  • Evaluation evidence is included (see Testing). Here: the structure, best-practices and functional results from the skill evaluation tool are committed under evals/.
  • No internal-only or proprietary content — no internal hostnames, account IDs, customer names, ticket numbers, internal URLs, or secrets in the tool, its examples, or its tests. Here: the example account ID is the AWS documentation example 111122223333, the resource IDs in the examples and prompts are made up, and in the committed functional results I replaced the test account's DynamoDB table name, security group IDs and stack names with placeholders. The test account's own ID appears there only as 012345678901_1, the placeholder the skill evaluation tool writes when it redacts an account ID. Upstream's identifier allowlist names that placeholder, and scan_aws_identifiers.py reports 0 findings in the 263 files.
  • README is complete — prerequisites, setup/deployment, and at least one sample prompt or usage example. Here: prerequisites, packaging and upload steps, and sample prompts for Chat and Incident RCA.
  • CHANGELOG updated and the version bumped. Here: one 1.0.0 entry for a new skill.
  • Named owner for ongoing maintenance. Here: @vgaglia-aws.

Testing

  • structure checks pass. Here: evals/structure/structure-tests-results-v4.json, score 100, 12 of 12 checks passed, run 2026-12-03.
  • best-practices run across multiple iterations, with consistent results. Here: evals/best-practices/v7/, 3 iterations on 2026-12-03, 100 / 100 / 100 with every one of the 17 checks passing in all three (consistency 100), judge model us.anthropic.claude-sonnet-5. An earlier run on the same SKILL.md is described below.
  • functional run with and without the change, so the difference in the agent's behavior is visible. Here: evals/functional/v6/, 3 iterations of the 25 cases on 2026-12-03 (both arms for the 16 should-trigger cases and the skill arm only for the 9 should-not-trigger cases: 16 x 3 x 2 + 9 x 3 = 123 runs), with 0 runs failed in the tool. With the skill available the agent loaded it in 38 of the 48 runs of the 16 should-trigger cases, passed 211 of 222 assertion checks and met the expected output in 46 of 48 runs; without the skill it passed 160 of 222 checks, 4 of which could not be judged (see below), and met the expected output in 38 of 48.
  • evals/evals.json includes positive cases (should trigger) and at least one negative case (should not trigger on unrelated input). Here: 16 should-trigger cases with 74 assertions and 9 should-not-trigger cases (a database security audit, a posture report on open 0.0.0.0/0 rules, a security-group rule quota error, a Python function, the weather, a slow query on a connected database, marketing spend, DynamoDB hot-partition throttling and ElastiCache evictions); the skill loaded in none of the 27 runs of the negative cases.

All three result sets come from the skill evaluation tool and are committed under evals/, the last run of each suite: evals/functional/v6/, evals/best-practices/v7/ and evals/structure/structure-tests-results-v4.json (the version numbers are the tool's). Manual with-skill and without-skill Ops Agent output is not attached.

The best-practices suite ran twice on this SKILL.md, and v7 is the second run. The first, the tool's v6, is left out because CONTRIBUTING.md asks for only the last version of each test type. It scored 94, 94 and 100. Each 94 had one check that did not pass and one warning. The judge failed the check for reference material in the body once, naming the hop list, the severity definitions and Steps 2 to 4. It errored the description check once by returning a verdict the tool does not allow. Both times it warned that the body explains general networking, such as network ACL return traffic and ephemeral ports. All of those passages were in the body before the apply-a-fix instruction, the last change to it.

In the functional run, whose judge is us.anthropic.claude-sonnet-5, no assertion is always_fails: evals/functional/v6/benchmark.json classes the 74 assertions as 47 always_passes, 16 flaky and 11 skill_uplift. The 38 with-skill runs that loaded the skill passed 172 of 179 checks and met the expected output in all 38. In the other 10 the agent answered without loading it, and passed 39 of 43 checks and 8 of 10 expected outputs. They include all three runs of two cases, the engine default ports (recall-02) and the TLS settings for Oracle and DocumentDB (recall-14). The agent answers both in full without the skill: every assertion and expected output of those two cases passes in both arms. Two other should-trigger cases, recall-04 and recall-08, meet their expected output in 0 of 3 runs without the skill and in 3 of 3 with it; one of the three recall-04 runs without it is the run described next.

One without-skill run, iteration 3 of recall-04 (whether the agent can run VPC Reachability Analyzer), ended with no final response, so the judge had nothing to grade: its 4 assertion checks were not judged and its expected output failed. That is why the without-skill arm reads 160 passed of 222 with 4 not judged. 38 should-trigger runs (5 with the skill, 33 without) report a runtime of 0s and a cost of $0.00 in their metrics. Each of them was judged on a final response, so those two readings do not mean that a run did not execute.

One change to SKILL.md came from the functional evals. The recall-03 case asks what else has to be true for an internet client to reach an RDS instance that has PubliclyAccessible set, and whether the agent can change any of it or only say what to change. In the last functional run before that change, the agent with the skill loaded offered to apply some fixes with the user's approval, such as a route to an internet gateway, and the expected output passed in 0 of 3 runs. My skill said that every fix is a recommendation the user applies, but not how to answer that question. I added the instruction at SKILL.md lines 44 to 48 and re-ran all three suites, and the results committed here are that re-run. With the skill, recall-03 now meets the expected output in 3 of 3 runs (1 of 3 without it), and each of the three answers tells the user to apply the fix and offers to apply nothing.

The prompts in evals/evals.json changed too. Four of them (smoke-01, recall-03, recall-04 and recall-06) referred to the skill itself, with words such as "this skill" or "the read-only skill". A prompt like that tells the run without the skill what kind of answer is wanted, and a user would not type it. Without those words some of the four no longer said that a database was involved, so each now opens with a failing connection to an RDS or Aurora database and asks its question without naming the skill. The recall-13 expected output and one of its five assertions gave a 1-second TTL for the reader endpoint, a figure I could not find in the Aurora endpoint documentation. references/REFERENCE.md no longer gives it and names a dig command that reads the live TTL, and the case now asks for a short TTL.

The evals ran on this SKILL.md with one difference, line 5: it said version: "1.1.5", the version number my own copy had reached. A new skill starts at 1.0.0 here, so after the evals I changed that line and nothing else; the 38 with-skill journals that loaded the skill still show version: "1.1.5". The tool's upload to the agent holds SKILL.md, references/, assets/ and automation/iam-policy.json and leaves out README.md, CHANGELOG.md and evals/, so the CHANGELOG and the evals/ folder of this PR did not change what the agent read.

Skills — complete if this PR adds or changes a skill

  • SKILL.md frontmatter is valid: name matches the directory, description present and within length limits, body at most 500 lines. Here: description is 927 characters, the body is 368 lines as the upstream check counts them, and metadata.summary is set. validate_skills.py reports 0 errors and 3 warnings: "Amazon Aurora", "Amazon DocumentDB" and "Amazon DynamoDB" in aws-services are not in vocabulary.json.
  • The description is written from the agent's point of view — scenarios, services, error types, symptoms. Here: symptoms, verbatim error codes and scenarios, and it says it is a reactive break-point diagnosis, not a posture audit.
  • Scoped to a specific agent type in metadata.aws-devops-agent-skills.agent-types (INCIDENT_RCA, INCIDENT_TRIAGE, INCIDENT_MITIGATION, …), not left GENERIC without reason. Here: CHAT, INCIDENT_RCA.
  • Procedures are structured as decision trees on real conditions, not flat prose. Here: Step 3 walks the hops in a fixed order and gives each one PASS, FAIL or UNKNOWN on the conditions in references/REFERENCE.md sections (b) to (h); a server error code or a known false signal cuts the walk short.
  • Reference material lives in references/ or assets/ and loads on demand. Here: 14 pointers that say when to load a section of references/REFERENCE.md, and two to assets/ (the report template and a sample context).
  • Non-executable content only — no scripts or code in the skill directory. Deterministic compute belongs in an MCP server. Here: Markdown and JSON, plus the .skilleval.yaml audit setting; no scripts or code.

Security and safety

  • Read-only by default; any action that changes customer state is explicit, documented, and approval-gated. Here: the skill has no action that changes customer state; every fix is a recommendation the user applies, and when asked to apply one, the agent gives the exact change and does not apply it.
  • Customer data stays in the customer's account.
  • No destructive operations without an explicit, documented confirmation step. Here: no destructive operations at all.

License confirmation

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache License 2.0.

This description was drafted with an AI assistant and reviewed by me.

Skill version 1.0.0.

Results of the skill evaluation tool, committed under evals/:
- structure v2: 12 of 12 tests passed, score 100.
- best-practices v3: 17 of 17 tests passed in each of 3 iterations,
  score 100, consistency 100.
- functional v3: 25 evals, 3 iterations. With the skill, 214 of 222
  assertions passed and the expected output matched in 48 of 48 runs.
  Without it, 142 of 207 assertions passed (10 more errored) and the
  expected output matched in 37 of 47 runs; one of the 48 without-skill
  runs failed in setup and has no result. The 9 negative cases did not
  trigger the skill in any of their 27 runs.
…nd policy fixes, new eval results

Folds the fixes into the 1.0.0 release and adds the answer to a request
to apply a fix: the trace only recommends, and gives the precise change
for the user to make without applying it. The fixes change SKILL.md,
references/REFERENCE.md, README.md, the two assets,
automation/README.md, automation/iam-policy.json (two prefix-list read
actions, 34 in all) and evals/evals.json (four prompts, one expected
output and one assertion); the 1.0.0 CHANGELOG entry describes what they
add. The structure, best-practices and functional results are replaced
by a new run of each against this skill: structure 100, best-practices
100 in each of three iterations, and in the functional run the skill
loaded in 38 of the 48 runs that should trigger it, with 211 of 222
assertion checks and 46 of 48 expected-output checks passing.
metadata.version stays 1.0.0, with one 1.0.0 CHANGELOG entry.
@vgaglia-aws

Copy link
Copy Markdown
Author

I pushed an update to the branch. It extends the skill: TLS-enforcement errors in the error index, the cluster and member instance status in the state check, the client-side rules for DynamoDB gateway endpoints, and engine-specific advice for max_connections and TLS parameters. The IAM policy gains two prefix-list read actions (34 in all), and four eval prompts no longer name the skill.

It also adds one instruction: when asked to apply a fix, the agent gives the exact change and does not apply it. I re-ran all three suites and replaced the results: structure 100, best-practices 100 in each of three iterations, and in the functional run the skill loaded in 38 of the 48 should-trigger runs, with 211 of 222 assertion checks and 46 of 48 expected outputs passing.

The version stays 1.0.0, with one 1.0.0 CHANGELOG entry, because the skill is not on main yet. I updated the description to match.

This comment was drafted with an AI assistant and reviewed by me.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant