Introducing Amazon Aurora powers for Kiro shows how you can build Amazon Aurora PostgreSQL-backed applications faster using AI agent-assisted development. This series takes it further. You start from a database administrator (DBA) perspective, using Kiro not to build apps, but to investigate and resolve database issues and progressively evolve the agent from an interactive assistant to an operator powered by Amazon Bedrock.

This two-part series evolves the agent from an interactive assistant to an agent powered by Amazon Bedrock:

  • Part 1 (this post): Use Kiro as a DBA assistant to investigate and resolve an Amazon Aurora performance issue.
  • Part 2: Add your organization’s runbooks and policies using Retrieval Augmented Generation (RAG) on Amazon Aurora PostgreSQL.

In this post, you learn how to create a custom DBA assistant with pre-configured tools and permissions, then use it to investigate a realistic Amazon Aurora performance incident using natural language. You identify root causes through Amazon CloudWatch metrics and Amazon CloudWatch Database Insights. Review, apply a fix, and verify the resolution, all without leaving the Kiro interface.

Solution overview

To get started, you install the Kiro CLI or IDE on your laptop or workspace, download and enable the awslabs.postgres-mcp-server and the awslabs.cloudwatch-mcp-server, and configure the Kiro CLI with an appropriate AWS profile to connect to Amazon Relational Database Service (Amazon RDS) or Amazon Aurora with the required privileges.

Kiro DBA assistant architecture: a workstation runs two MCP servers connecting to Aurora and RDS for PostgreSQL and to CloudWatch

Figure 1: High-level architecture of the Kiro DBA assistant

A DBA interacts with Kiro (CLI or IDE) on their workstation, which launches two Model Context Protocol (MCP) servers as local subprocesses. The awslabs.postgres-mcp-server uses your AWS profile and database credentials to connect to your PostgreSQL targets, such as an Amazon Aurora PostgreSQL cluster and an Amazon RDS for PostgreSQL instance. The awslabs.cloudwatch-mcp-server uses the same AWS profile to read Amazon CloudWatch metrics, alarms, and logs for those databases. The two virtual private clouds (VPCs) show that a single assistant can work across both engines, though running them in one VPC works equally well.

Example scenario

An incident alerting service alerts you: “Aurora PostgreSQL cluster demo-apg CPU utilization above 90% for 10 minutes. Database connections approaching limit.”

Normally, you’d open the Amazon RDS console, check Amazon CloudWatch dashboards, switch to Amazon CloudWatch Database Insights, connect with psql, run diagnostic queries, cross-reference documentation, message the application team on Slack, and context-switch between six different tools before you even understand the problem. With Kiro, you can handle this incident in a single interface.

This walkthrough shows how to handle incident response from initial triage through root cause analysis to resolution using Kiro with two MCP servers: the Aurora PostgreSQL MCP server and the Amazon CloudWatch MCP server. MCP is a standard for connecting AI assistants to external tools and data sources. For more information, see Aurora PostgreSQL MCP server.

Prerequisites

  • Kiro IDE or Kiro CLI installed with the Aurora PostgreSQL power configured. See Introducing Amazon Aurora powers for Kiro for setup instructions.
  • Python 3.10+ and uv installed. uv is a fast Python package and project manager for the MCP server runtime. Verify with python --version && uv --version.
  • AWS Command Line Interface (AWS CLI) configured with credentials (only the least privileges required). Verify with aws sts get-caller-identity.
  • An Aurora PostgreSQL cluster with Amazon CloudWatch Database Insights enabled (a feature that provides database performance monitoring and analysis).
  • IAM permissions to read Amazon CloudWatch metrics, alarms, and logs, and Database Insights (Performance Insights) data. See the IAM policy in the Security considerations section.

Note: This walkthrough uses demo-apg as the cluster name. Replace it with your own resource name throughout.

Create your DBA assistant agent

Before responding to incidents, create a “custom agent” for DBA work. With this one-time setup, you can launch the agent in seconds during future incidents.

  1. Create the agent directory by running the following command:
    mkdir -p ~/.kiro/agents
  2. Create a new file named dba-agent.json in the ~/.kiro/agents/ directory.
  3. Copy the following JSON configuration into the file.
    { "name": "dba-agent", "description": "DBA assistant for Amazon Aurora PostgreSQL and Amazon RDS incident response", "prompt": "You are a DBA assistant for Amazon Aurora PostgreSQL and Amazon RDS. When investigating performance issues, follow this sequence: 1) Check cluster status and instance health, 2) Pull CloudWatch metrics (CPU, connections, latency, freeable memory, DBLoad) using the CloudWatch MCP server, 3) Check Amazon CloudWatch Database Insights for top wait events and SQL by load using the Performance Insights API, 4) Connect to the database using the PostgreSQL MCP server and run diagnostic queries.", "mcpServers": { "awslabs.postgres-mcp-server": { "command": "uvx", "args": ["awslabs.postgres-mcp-server@latest"], "env": { "FASTMCP_LOG_LEVEL": "ERROR" } }, "awslabs.cloudwatch-mcp-server": { "command": "uvx", "args": ["awslabs.cloudwatch-mcp-server@latest"], "env": { "FASTMCP_LOG_LEVEL": "ERROR" } } }, "tools": ["*"], "allowedTools": [ "@awslabs.postgres-mcp-server", "@awslabs.cloudwatch-mcp-server" ], "welcomeMessage": "DBA Agent ready. What's the incident?" }

By default, the MCP server runs in read-only mode. The agent can investigate (SELECT, EXPLAIN) but cannot execute schema changes or data modifications directly. Recommended fixes are presented as commands for the DBA to execute through their change management process. See the Security considerations section for details.

  1. Save the file.

This configuration includes:

  • prompt: The DBA incident response playbook and conventions, loaded as system context for every conversation.
  • mcpServers: Two MCP servers, so you don’t need a separate mcp.json. The awslabs.postgres-mcp-server handles data plane operations (diagnostic SQL such as queries against pg_stat_activity and pg_stat_statements) and reads cluster and instance details. The awslabs.cloudwatch-mcp-server retrieves CloudWatch metrics (CPU, connections, latency, freeable memory), active alarms and alarm history, and Amazon CloudWatch Logs analysis, including the database load metrics that Database Insights publishes to the AWS/RDS namespace (DBLoad, DBLoadCPU, DBLoadNonCPU). The Database Insights top SQL and top wait event breakdowns come from read-only AWS CLI commands (aws pi get-resource-metrics, aws pi describe-dimension-keys) that Kiro runs with your AWS profile.
  • allowedTools: Auto-approves MCP server tool calls from the configured servers so you’re not prompted for permission during an incident.
  • welcomeMessage: Confirms you’re in the right agent when you launch.

To configure database credentials

The Aurora PostgreSQL MCP server requires database credentials. Configure them using one of these methods:

  1. AWS Secrets Manager (recommended): Store credentials in Secrets Manager and reference the secret ARN.
  2. Environment variables: Set PGUSER and PGPASSWORD before launching Kiro.

Example with AWS Secrets Manager

  1. Store credentials in Secrets Manager:
    aws secretsmanager create-secret \ --name aurora-dba-credentials \ --secret-string '{"username":"pg_ai_role","password":"your-password"}'
  2. Add to your dba-agent.json:
    "env": { "AWS_SECRET_ARN": "arn:aws:secretsmanager:us-east-1:123456789012:secret:aurora-dba-credentials" }

Credentials are held in process memory only for the active session. AWS credentials come from your local AWS profile, and database access uses RDS Data API, IAM authentication, or Secrets Manager-retrieved credentials, depending on the connection method chosen. Nothing persisted by the MCP server itself.

Security considerations

For production use, enforce write protection at three independent layers so the agent can only investigate, not modify:

Layer What it blocks Error if attempted
Steering file Agent won’t attempt writes Agent responds with the command for your change management process
Database role SQL writes (CREATE INDEX, DROP, INSERT) ERROR: cannot execute CREATE INDEX in a read-only transaction
IAM policy AWS API mutations (snapshots, modify, delete) AccessDeniedException: not authorized to perform rds:CreateDBClusterSnapshot

Steering file: Create the file .kiro/steering/dba-write-safety.md with the following content:

--- inclusion: always --- # Write safety guardrail NEVER execute DDL (CREATE, ALTER, DROP) or DML (INSERT, UPDATE, DELETE) on production databases. Only run SELECT and EXPLAIN queries for investigation. NEVER perform AWS control plane mutations (creating snapshots, modifying clusters, deleting resources, changing parameter groups). The IAM role attached to this agent has read-only access and these operations will fail with an AccessDenied error. When analysis suggests a remediation action (schema change, snapshot, parameter change, scaling), present it as a recommendation that requires change management approval per the organization's compliance policy. Include the exact command (SQL or AWS CLI) the DBA should execute through their change management process.

Database layer: Connect the PostgreSQL MCP server using a read-only role:

CREATE ROLE pg_ai_role LOGIN PASSWORD '...'; GRANT pg_read_all_data TO pg_ai_role; ALTER ROLE pg_ai_role SET default_transaction_read_only = on;

Note: default_transaction_read_only only sets the session default, and a session can override it (SET transaction_read_only = off). The role privileges are the real control: pg_read_all_data grants read access only, so DDL and DML still fail with a permission error. pg_read_all_data requires PostgreSQL 14 or later.

Store these credentials in Secrets Manager and reference them via AWS_SECRET_ARN in your agent config.

IAM layer: Attach the following policy to the AWS profile used by the MCP servers and Kiro. It allows the read actions that the PostgreSQL MCP server, the CloudWatch MCP server, and the Database Insights (Performance Insights) CLI calls need, and explicitly denies mutations:

{ "Version": "2012-10-17", "Statement": [ { "Sid": "RdsAndDataApiRead", "Effect": "Allow", "Action": [ "rds:Describe*", "rds-data:ExecuteStatement", "secretsmanager:GetSecretValue" ], "Resource": "*" }, { "Sid": "CloudWatchMcpServerRead", "Effect": "Allow", "Action": [ "cloudwatch:DescribeAlarms", "cloudwatch:DescribeAlarmHistory", "cloudwatch:GetMetricData", "cloudwatch:ListMetrics", "logs:DescribeLogGroups", "logs:DescribeQueryDefinitions", "logs:ListLogAnomalyDetectors", "logs:ListAnomalies", "logs:StartQuery", "logs:GetQueryResults", "logs:StopQuery" ], "Resource": "*" }, { "Sid": "DatabaseInsightsRead", "Effect": "Allow", "Action": [ "pi:GetResourceMetrics", "pi:DescribeDimensionKeys", "pi:GetDimensionKeyDetails", "pi:GetResourceMetadata", "pi:ListAvailableResourceDimensions", "pi:ListAvailableResourceMetrics" ], "Resource": "*" }, { "Sid": "DenyMutations", "Effect": "Deny", "Action": [ "rds:Create*", "rds:Delete*", "rds:Modify*", "rds:Reboot*", "rds:Start*", "rds:Stop*", "cloudwatch:Put*", "cloudwatch:Delete*", "logs:Put*", "logs:Delete*" ], "Resource": "*" } ] }

With all three layers in place, the agent operates strictly as an investigator surfacing insights and recommendations while leaving the changes to your established change management process.

Demonstration

In the following video, we walk through a real-world scenario where an incident occurs on an Amazon Aurora PostgreSQL-Compatible Edition cluster. Watch as a database administrator uses the agent you configured earlier to quickly identify and troubleshoot the issue.

To apply the fix

After reviewing these recommendations with the application team, you decide to redirect the read traffic for this function to the reader instance to reduce writer load. You also choose to apply Fix 2: creating an index.

First, create a snapshot manually (not with Agent) and name it appropriately like “pre-index-fix-demo-apg” before you make changes.

aws rds create-db-cluster-snapshot --db-cluster-identifier demo-apg --db-cluster-snapshot-identifier pre-index-fix-demo-apg

Wait for the snapshot to be completed.

After consulting with the application team, you determined that Fix 2 from the preceding video is the best fit for most queries originating from the application. To implement this fix, you connect using our DBA role and create the following index.

CREATE INDEX CONCURRENTLY idx_orders_customer_created ON orders (customer_id, created_at);

Once the index is in place, validate the change by reviewing the explain plans for the relevant queries to confirm that the new index is improving query performance.

It’s important to note that these recommendations are based on general best practices and the current state of your database. Since the assistant doesn’t have access to your historical performance data, operational runbooks, or environment-specific configurations, the suggestions may need to be validated against your workload profile. To address this, in Part 2 of this series, you build a RAG solution on Aurora PostgreSQL that stores your standard operating procedures (SOPs), historical metrics, and environment context so the DBA assistant can deliver recommendations tailored to your specific environment.

Note: Don’t delete the resources you created in this post. You use them in Part 2, which includes a cleanup section that removes everything when you’re done.

Conclusion

In this post, you learned how to use Kiro to create a DBA assistant that can diagnose live performance issues, analyze root causes, capture recommendations, and manually apply the appropriate fix on the database adhering to your established change management process.

The workflow combined control plane and monitoring reads (cluster status, CloudWatch metrics and alarms, Database Insights load analysis) with data plane operations (diagnostic queries) in one conversation, avoiding the context-switching that fragments incident response. The three-layer security model keeps the agent read-only by default while still providing actionable recommendations with exact commands for your change management process.

Kiro with Aurora PostgreSQL powers is more than a natural language wrapper around SQL. The steering files provide production-safe defaults and best practices that guide every recommendation, and custom steering files let you encode your team’s specific conventions.

Next steps:

In Part 2, you go beyond static steering files by adding a RAG layer that uses pgvector on Aurora PostgreSQL. With it, your DBA agent can draw on your organization’s runbooks, incident history, and compliance documentation, so the next time you get paged at 2 AM, the agent already knows what your team did last time.


About the authors

Narendra Tawar

Narendra Tawar

Narendra is a Senior Database Specialist Solutions Architect at AWS, bringing over two decades of experience across Oracle, PostgreSQL, SQL Server, and MySQL, including a decade of deep PostgreSQL specialization. He partners with enterprises to architect, migrate, and optimize PostgreSQL on Amazon RDS and Aurora, with a focus on target architecture, isolation and sharding, and performance at scale.

Kranthi Kiran Burada

Kranthi Kiran Burada

Kranthi is a Sr. Database Solutions Architect at AWS, specializing in facilitating the transition of clients from commercial databases to open-source solutions like PostgreSQL. With a keen focus on PostgreSQL, he actively engages in performance optimization, database design, troubleshooting, and imparting best practices during migrations from Oracle/SQL Server to PostgreSQL.

Dwarka Rao

Dwarka Rao

Dwarka Rao is a Sr. Database Specialist Solutions Architect at Amazon Web Services, based in Amsterdam. He has spent 17 years working with Oracle and PostgreSQL, and helps customers across the Nordics and Benelux design, migrate and run databases that are reliable, secure and fast.