Amazon Aurora Mysql
AWSOfficialPublished by AWS
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The Amazon Aurora MySQL skill provides a structured, sub-skill-based approach to managing Aurora MySQL clusters. It covers the full lifecycle of cluster operations, including creation, capacity planning for serverless workloads, storage optimization analysis, commitment pricing assessments, and version upgrade planning. The skill enforces strict safety guardrails, requiring user confirmation for all mutations and blocking high-risk operations like public accessibility or irreversible deletions. It integrates with AWS CLI and MCP for direct execution while providing offline analysis scripts for cost and capacity modeling.
What it does
- Routes requests to specialized sub-skills for creation, serverless advisory, I/O optimization, pricing, and upgrades.
- Executes cluster modifications and creations directly via AWS MCP or CLI with mandatory safety confirmations.
- Calculates cost-saving opportunities using Reserved Instances and Database Savings Plans.
- Analyzes Aurora serverless ACU sizing and I/O-Optimized storage cost-effectiveness.
- Provides pre- and post-upgrade checklists for major and minor version transitions.
- Applies required resource tags automatically to all new cluster deployments.
When to use it
- When provisioning a new Aurora MySQL cluster or modifying existing cluster configurations.
- When evaluating the cost-benefit of switching to I/O-Optimized storage.
- When planning major or minor version upgrades for Aurora MySQL.
- When analyzing whether to purchase Reserved Instances or Database Savings Plans to optimize costs.
- When determining appropriate ACU capacity for Aurora serverless workloads.
Advantages
- Ensures consistent resource tagging and safety-first execution for all infrastructure changes.
- Provides data-driven cost analysis for commitment pricing and storage upgrades.
- Reduces operational risk by blocking unsafe configurations like public database access.
- Simplifies complex upgrade planning with structured checklists and version guidance.
- Maintains context across multiple sub-skills for comprehensive cluster management.
Usage examples
- “I need to set up a new Aurora MySQL cluster in us-east-1.”
- The agent will route to the create sub-skill, collect necessary VPC, security group, and engine version details, and guide you through the creation process with mandatory tagging.
- “Should I switch my Aurora Standard cluster to I/O-Optimized storage?”
- The agent will run the I/O-Optimized analyzer to compare your current costs against the 25% threshold rule and provide a recommendation.
- “How many ACUs should I provision for my serverless workload?”
- The agent will use the ACU calculator script to estimate capacity based on your P95 and max CPU requirements.
- “Is it better to buy a Reserved Instance or a Savings Plan for my database?”
- The agent will perform a cost comparison analysis between RI and DSP options based on your specific instance type and region.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/aws/amazon-aurora-mysql/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip amazon-aurora-mysql.zip -d .agents/skills
Documentation by AWS
Amazon Aurora MySQL
A modular toolkit for Aurora MySQL organized as a registry of sub-skills. Each sub-skill handles one domain of Aurora MySQL work. The router matches user intent to the right sub-skill, then loads only the references needed. (For Aurora PostgreSQL — and its express-configuration quick-start — use the amazon-aurora-postgresql skill.)
Operating procedure (follow in order)
Route — match the request to a sub-skill using the Trigger phrases column (match on meaning, not exact wording), then confirm with the When to route here column.
Load —
file_readthe matched sub-skill'sreferences/{id}-instructions.mdand announce the path. Do not answer a matched sub-skill from general knowledge alone.Analyze / advise — perform the sub-skill's work; run a bundled script when the user supplies the inputs (see Scripts).
If a mutation is requested — classify against the Safety guardrails tier, confirm with the user, apply resource tags, then execute (MCP-preferred, CLI fallback).
Present results — tables with dollar/ACU figures and a recommendation label; no derivation or arithmetic steps.
Edge cases: if the request spans multiple sub-skills, run them in sequence (load each instructions.md in turn). If no sub-skill matches, answer directly from Aurora MySQL knowledge. If a script or MCP/CLI call fails, show the error and suggest a fix before retrying. The numbered Global rules below are details that hang off these steps.
Sub-skill registry
Column semantics: Trigger phrases = the keyword index you match the request against (step 1). When to route here = the decision logic confirming the match. Next steps = sub-skills to offer the user as a natural follow-up after this one completes (not auto-chained); Reached from = sub-skills that typically route into this one. Next-steps/Reached-from are suggestions for guiding the user, never automatic execution.
| ID | Name | When to route here | Trigger phrases | Reached from | Next steps |
|---|---|---|---|---|---|
create | Create Cluster | Routes Aurora MySQL cluster creation requests. Aurora MySQL uses full (VPC-based) configuration — collect VPC/subnet group, security group, KMS, parameter group, and engine version, present options, then create. (Express configuration is PostgreSQL-only and does not apply to Aurora MySQL.) | create a cluster, new database, set up Aurora MySQL, get started, need a MySQL database, provision | — | serverless-advisory, io-optimized |
serverless-advisory | Aurora serverless Advisory | All Aurora serverless questions: ACU sizing, scale-to-zero behavior and compatibility, provisioned→serverless migration, capacity planning, and feature constraints. | ACU sizing, Aurora serverless, scale-to-zero, provisioned to serverless, how many ACUs, capacity, auto-scaling, RDS Proxy compatibility, scale-to-zero incompatibility, serverless limitations | create (optional) | commitment-pricing |
io-optimized | I/O-Optimized Storage | Evaluates whether to switch from Aurora Standard to I/O-Optimized (aurora-iopt1). Uses the 25% I/O cost threshold rule. | I/O-Optimized, aurora-iopt1, storage type switch, 25% threshold, I/O costs too high, storage comparison | — | — |
commitment-pricing | Commitment Pricing | Compares Reserved Instances vs Database Savings Plans for provisioned clusters, and DSP-only for Aurora serverless. 1yr vs 3yr analysis. | Reserved Instance, RI, Savings Plan, DSP, 1yr vs 3yr, commitment, cost optimization, overpaying | serverless-advisory (optional) | — |
upgrade-planning | Upgrade Planning | Major and minor version upgrade planning for Aurora MySQL. LTS version guidance, pre/post-upgrade checklists, blue/green deployment recommendations. | upgrade, version, LTS, pre-upgrade checklist, post-upgrade, major version, minor version, end of life, deprecation | — | — |
Global rules (apply to every sub-skill)
Execute, don't just suggest. When the user requests an action and confirms, EXECUTE it rather than handing back a command to run. The AWS MCP server is the recommended execution path when available (sandboxed, IAM-authenticated, audit-logged) — prefer it. When MCP tools are not available (e.g. Claude Code, Cursor, or other non-MCP hosts), use the AWS CLI / SDK directly with the same
aws rds ...operation. Only if execution is genuinely not possible in the current environment, present the complete CLI command for the user to run.Confirmation before mutation. MUST confirm with the user before any create or modify operation. Do NOT execute without explicit confirmation ("yes", "proceed", "confirmed", "go ahead").
Resource tagging (always apply on resource creation). When creating any cluster or instance, ALWAYS include these tags:
--tags Key=created_by,Value=aurora-skill Key=generation_model,Value={your-model-id}Use your model id if known; if you cannot reliably determine it, useValue=unknown— never let tagging block the create. Include these tags even if the user does not mention tagging. If the user provides additional tags, append these to their tags.Safety guardrails.
Tier 1 — Confirm (a yes/no confirmation is enough; no risk briefing required):
create-db-cluster(full/VPC configuration — Aurora MySQL does not support express)create-db-instancemodify-db-cluster --serverless-v2-scaling-configuration(ACU scaling)modify-db-cluster --backup-retention-periodmodify-db-cluster --deletion-protection/--no-deletion-protectionmodify-db-cluster --enable-cloudwatch-logs-exportsmodify-db-cluster --preferred-backup-windowmodify-db-cluster --enable-http-endpoint(Data API)add-tags-to-resource,remove-tags-from-resource
Tier 2 — High-impact: state the specific risk, THEN confirm (spell out the impact before asking; do not call any API until the user confirms with that risk in front of them):
modify-db-cluster --storage-type— no downtime for most instance classes; requires restart for NVMe/Optimized Reads instances (r6gd, r6id, r8gd). Switching from Aurora Standard to Aurora I/O-Optimized is limited to once every 30 days; switching from Aurora I/O-Optimized back to Aurora Standard can be done at any time.modify-db-instance --db-instance-class— causes failover in multi-AZmodify-db-cluster --engine-versionfor a minor version upgrade — applied in the maintenance window (or immediately with--apply-immediately); brief failover/restart. State the target version and the restart impact, then confirm. (For a major version upgrade, see Block below — route toupgrade-planningfirst.)How to tell minor from major (Aurora MySQL): the Aurora MySQL version is
major.minor.patch(e.g.3.06,3.08). The major digit (2= MySQL 5.7-compatible,3= MySQL 8.0-compatible,8.4+) is the major version; the second number is the minor version. So 3.06 → 3.08 is a MINOR upgrade (major3unchanged) → handle here in Tier 2. A change in the leading major (e.g.2.x → 3.x, or 5.7 → 8.0 compatibility) is a major upgrade → Block. When unsure, treat it as major and route toupgrade-planning.
Any modify with
--apply-immediately— bypasses maintenance window
Tier 3 — Block (refuse, explain why, redirect to console/change-control):
delete-db-cluster,delete-db-instance— irreversiblefailover-db-cluster,switchover-blue-green-deployment— production impactmodify-db-cluster --engine-versionacross major versions — requires prechecks and rollback planmodify-db-cluster --master-user-password,--manage-master-user-password— credential management must be performed by the customer directly. Use AWS Secrets Manager rotation or the AWS Console.modify-db-cluster --vpc-security-group-ids— network security posture changemodify-db-cluster --db-cluster-parameter-group-name— can break applicationscreate-db-instance --publicly-accessible,modify-db-instance --publicly-accessible— NEVER make Aurora instances publicly accessible. This exposes the database directly to the internet and is never the correct solution for connectivity. See secure connection alternatives below.purchase-reserved-db-instances-offering,create-savings-plan— financial commitmentreboot-db-instance,reboot-db-cluster— production impact
When blocking, you MUST refuse immediately. Do NOT call any AWS API. Your response MUST have exactly two paragraphs:
Paragraph 1 — refuse: "I can't perform [action] because [reason]. This should go through your team's change-control process or the AWS Console."
Paragraph 2 — alternative (from the table below, always included):
purchase-reserved-db-instances-offering,create-savings-plan→ "I can run a commitment pricing assessment (RI vs DSP comparison) so you have the numbers to bring to procurement."delete-db-cluster,delete-db-instance→ "I can help with snapshot creation or final-snapshot validation before deletion."modify-db-cluster --engine-version(major version) → "I can run an upgrade assessment — target version recommendation, prechecks, and pre/post checklists."failover-db-cluster,switchover-blue-green-deployment→ "I can validate the cluster's state and review the failover/switchover plan with you."reboot-db-instance,reboot-db-cluster→ "I can check for pending modifications and recommend a maintenance window."modify-db-cluster --master-user-password/--manage-master-user-password→ "Rotate the password via AWS Secrets Manager or the AWS Console; both are safer than a direct API call. I can walk you through enabling Secrets Manager managed rotation."--publicly-accessible→ "Making the instance publicly accessible exposes the database directly to the internet — this is a security anti-pattern even for prototypes. Instead: (1) Enable RDS Data API — query over HTTPS with IAM auth; (2) EC2 bastion with SSH tunnel; (3) connect from within the VPC (e.g. a workload in the same VPC or via VPN/Direct Connect). I can help you set up any of these."modify-db-cluster --vpc-security-group-ids→ "I can describe the cluster's current security-group configuration and help you draft the intended change so you can apply it through your team's change-control process or the AWS Console."modify-db-cluster --db-cluster-parameter-group-name→ "I can review the current parameter group and compare it against the target group (highlighting reboot-required parameters) so you can prepare the change for your team's change-control process or the AWS Console."
Never omit paragraph 2. A refusal without an alternative is incomplete.
Reference loading. Before responding to any matched sub-skill request, you MUST read
references/{id}-instructions.mdusing your file-read tool (file_readif available, otherwise whatever your runtime exposes). Do not answer a matched sub-skill from the registry summary alone. Announce the path in your reply.Stay in scope. Once this skill is active, recommend the best Aurora MySQL configuration for the workload. Do not suggest non-AWS alternatives. For light or intermittent workloads, recommend Aurora serverless with scale-to-zero.
Never fabricate. Do NOT invent AWS API results, pricing numbers, version lists, or instance metadata. If a live call fails, report the blocker and offer offline mode with user-supplied numbers.
Carry context forward. Pass along cluster ID, region, and workload details the user already supplied. They SHOULD NOT have to re-type information already in the conversation.
Broad requests. If the user says "help me with Aurora MySQL" or "analyze my cluster" without specifying a domain (create, sizing, I/O, commitment, upgrade), present the sub-skill domains as one line each and ask which they want to focus on. Do NOT silently pick a sub-skill and run it. Acknowledge any cluster ID and region so the user doesn't need to repeat them.
Out-of-scope topics. If the user asks about an Aurora feature not covered by a sub-skill (e.g., Global Database, Blue/Green Deployments, RDS Proxy), note that it is not covered by a specific sub-skill, answer from general Aurora knowledge, and link to the relevant AWS documentation page.
Credential safety. Do not create, store, or display long-lived credentials or DB passwords.
aws rds generate-db-auth-tokenis approved when IAM database authentication is enabled on the cluster — it produces a short-lived (15-minute) IAM token. Otherwise, use user-supplied secret ARNs (AWS Secrets Manager) or pre-configured tunnels.Present results clearly. Use tables with dollar figures, ACU numbers, and recommendation labels. Do NOT show derivation or arithmetic steps. Exception: when consolidating across multiple analyses ("summarize", "what should I do"), respond in 2-4 lines of plain prose — no headers, no bullets, no tables.
Scripts
Bundled scripts in scripts/ for offline analysis. MUST use these when the user provides the required inputs — do NOT hand-calculate. Each script documents its full flags/usage in its own --help and header docstring; read those on demand rather than relying only on the one-line usage below.
Script execution model: If a shell is available, execute the script directly and present the output. If no shell is available, print the exact command as a fenced bash code block with all flags resolved to user-supplied values, then present results computed inline from the reference file's pricing tables. (Result-presentation format is governed by the Operating procedure / Global rules — no derivation steps.)
| Script | Purpose | Usage |
|---|---|---|
acu_calculator.py | Aurora serverless ACU sizing | python3 scripts/acu_calculator.py estimate --instance <type> --cpu-p95 <val> --cpu-max <val> --storage <val> |
io_optimized_analyzer.py | I/O-Optimized breakeven | python3 scripts/io_optimized_analyzer.py offline --instance <type> --num-instances <n> --storage-gib <val> --monthly-io-millions <val> |
commitment_pricing_analyzer.py | RI vs DSP cost comparison | python3 scripts/commitment_pricing_analyzer.py offline --instance <type> --num-instances <n> --region <region> (provisioned) or --serverless --avg-acu <val> (Aurora serverless) |
Troubleshooting
AccessDenied: Attach
AmazonRDSReadOnlyAccess+CloudWatchReadOnlyAccessfor reads. For creates/modifies, use a custom policy scoped tords:CreateDBCluster,rds:CreateDBInstance,rds:ModifyDBCluster,rds:ModifyDBInstance,rds:AddTagsToResource, andrds:Describe*. See Identity and access management for Amazon Aurora.ExpiredToken / credentials: Refresh your AWS credentials using whatever mechanism you use (e.g. re-run your SSO/
aws sso login,ada credentials update, assume-role, or refresh the profile), then retry. Do not assume a specific credential tool.DBClusterNotFoundFault: Verify region and cluster ID.
Throttling: Retry once, then narrow scope.
Additional Resources
Handoff from aws-database-selection
This skill can be entered from aws-database-selection after it produces a requirements.json. When you see a path matching aws_dbs_requirements/*/requirements.json in conversation:
Read the artifact. Sanity-check it has the fields you'll use — at minimum
engine(or workload type),region, and the workload signals you route on (capacity/ACU hints, storage size, connectivity/VPC needs, version). If those are present and parseable, use them; if it's missing them or won't parse, proceed without it (don't block on a formal schema).Acknowledge relevant facts in 1-2 bold sentences.
Scope-check: if the artifact doesn't match Aurora (e.g., key-access → DynamoDB, graph → Neptune, multi-region strong SQL → DSQL), suggest the right skill and ask whether to proceed anyway.
Continue with this skill's sub-skill routing.
Files
- ATTRIBUTION.mdAdded by AutoGineer926 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer67 B
- SKILL.md17.0 KiB
- references/commitment-pricing-basics.md5.4 KiB
- references/commitment-pricing-instructions.md7.2 KiB
- references/commitment-pricing-mechanics.md6.0 KiB
- references/commitment-pricing-scenarios.md4.4 KiB
- references/commitment-pricing-skipped-cluster.md3.5 KiB
- references/commitment-pricing-worked-examples.md5.8 KiB
- references/create-instructions.md4.8 KiB
- references/io-optimized-data-collection.md4.2 KiB
- references/io-optimized-instructions.md6.9 KiB
- references/io-optimized-pricing-tables.md5.9 KiB
- references/io-optimized-pricing.md3.0 KiB
- references/io-optimized-worked-examples.md4.3 KiB
- references/serverless-advisory-concepts.md3.2 KiB
- references/serverless-advisory-formulas-and-examples.md4.5 KiB
- references/serverless-advisory-instructions.md7.0 KiB
- references/serverless-advisory-migration.md6.7 KiB
- references/serverless-advisory-worked-examples.md7.2 KiB
- references/shared-foundation-security-considerations.md5.5 KiB
- references/upgrade-planning-documentation-links.md2.0 KiB
- references/upgrade-planning-instructions.md5.7 KiB
- references/upgrade-planning-lts-recommendation.md4.8 KiB
- references/upgrade-planning-mode-b-discovery.md4.3 KiB
- references/upgrade-planning-mode-b-prechecks-checklists.md4.0 KiB
- references/upgrade-planning-post-checklist.md3.0 KiB
- references/upgrade-planning-post-upgrade-detail.md6.0 KiB
- references/upgrade-planning-post-upgrade-validation.md4.2 KiB
- references/upgrade-planning-pre-checklist.md3.2 KiB
- references/upgrade-planning-prechecks-mysql.md8.7 KiB
- references/upgrade-planning-query-load-mysql.md4.8 KiB
- scripts/acu_calculator.pyScript35.8 KiB
- scripts/commitment_pricing_analyzer.pyScript32.6 KiB
- scripts/io_optimized_analyzer.pyScript25.6 KiB
scripts/io_optimized_analyzer.py
"""Aurora I/O-Optimized vs Standard cost analyzer.
Assesses whether Aurora I/O-Optimized is a better fit than Aurora Standard for
one cluster, all clusters in a region, or offline user-supplied numbers.
Decision: I/O-Optimized is recommended when it actually lowers total monthly cost
(eliminated I/O charges exceed the compute + storage premium). The "I/O >= 25% of
total spend" figure is a useful rule-of-thumb, but the recommendation is gated on the
computed dollar savings, not the percentage alone (they can diverge near breakeven).
Same logic across Aurora engines (engine-neutral pricing math).
Pricing math and breakeven logic cross-checked with AWS documentation.
Usage:
python io_optimized_analyzer.py --cluster my-cluster --region us-east-1
python io_optimized_analyzer.py --all --region us-east-1 --days 14
python io_optimized_analyzer.py offline --instance db.r6g.2xlarge \\
--num-instances 2 --storage-gib 800 --monthly-io-millions 1200
"""
from __future__ import annotations
import argparse
import datetime as dt
import json
import sys
from typing import Any
# ---------------------------------------------------------------------------
# Pricing constants (us-east-1). Overridden by live API when available.
# ---------------------------------------------------------------------------
STORAGE_STANDARD_PER_GIB = 0.10 # $/GiB-month, Standard
STORAGE_IO_OPT_PER_GIB = 0.225 # $/GiB-month, I/O-Optimized
IO_COST_PER_MILLION = 0.20 # $/million I/O requests, Standard only
IO_OPT_COMPUTE_MULTIPLIER = 1.30 # 30% compute premium on I/O-Optimized
IO_OPT_BREAKEVEN_PCT = 25.0
HOURS_PER_MONTH = 730
MIN_VIABLE_DAYS = 7.0
# Static instance hourly prices (us-east-1, Standard, Aurora MySQL).
# Aurora MySQL and PostgreSQL share these rates; I/O-Optimized is derived via the multiplier.
_STATIC_INSTANCE_PRICES = {
"db.t3.medium": 0.082,
"db.t3.large": 0.164,
"db.t4g.medium": 0.073,
"db.t4g.large": 0.146,
"db.r5.large": 0.290,
"db.r5.xlarge": 0.580,
"db.r5.2xlarge": 1.160,
"db.r5.4xlarge": 2.320,
"db.r5.8xlarge": 4.640,
"db.r5.12xlarge": 6.960,
"db.r5.16xlarge": 9.280,
"db.r5.24xlarge": 13.920,
"db.r6g.large": 0.260,
"db.r6g.xlarge": 0.519,
"db.r6g.2xlarge": 1.038,
"db.r6g.4xlarge": 2.076,
"db.r6g.8xlarge": 4.152,
"db.r6g.12xlarge": 6.228,
"db.r6g.16xlarge": 8.304,
"db.r7g.large": 0.276,
"db.r7g.xlarge": 0.553,
"db.r7g.2xlarge": 1.106,
"db.r7g.4xlarge": 2.211,
"db.r7g.8xlarge": 4.422,
"db.r7g.12xlarge": 6.633,
"db.r7g.16xlarge": 8.844,
"db.r8g.large": 0.276,
"db.r8g.xlarge": 0.552,
"db.r8g.2xlarge": 1.104,
"db.r8g.4xlarge": 2.208,
"db.r8g.8xlarge": 4.416,
"db.r8g.12xlarge": 6.624,
"db.r8g.16xlarge": 8.832,
"db.r8g.24xlarge": 13.248,
"db.r8g.48xlarge": 26.496,
}
_REGION_NAMES = {
"us-east-1": "US East (N. Virginia)",
"us-east-2": "US East (Ohio)",
"us-west-1": "US West (N. California)",
"us-west-2": "US West (Oregon)",
"eu-west-1": "EU (Ireland)",
"eu-west-2": "EU (London)",
"eu-central-1": "EU (Frankfurt)",
"eu-north-1": "EU (Stockholm)",
"ap-southeast-1": "Asia Pacific (Singapore)",
"ap-southeast-2": "Asia Pacific (Sydney)",
"ap-northeast-1": "Asia Pacific (Tokyo)",
"ap-south-1": "Asia Pacific (Mumbai)",
"ca-central-1": "Canada (Central)",
"sa-east-1": "South America (Sao Paulo)",
}
INSTANCE_PRICES = dict(_STATIC_INSTANCE_PRICES)
_pricing_source: dict[str, Any] = {"source": "static_fallback", "region": "us-east-1"}
# ---------------------------------------------------------------------------
# Live pricing (best-effort)
# ---------------------------------------------------------------------------
def refresh_pricing(region: str) -> dict:
"""Try to fetch live instance + storage + I/O pricing. Silent fallback on failure."""
global INSTANCE_PRICES, STORAGE_STANDARD_PER_GIB, STORAGE_IO_OPT_PER_GIB
global IO_COST_PER_MILLION, _pricing_source
location = _REGION_NAMES.get(region)
if not location:
_pricing_source = {
"source": "static_fallback",
"region": region,
"note": f"Region {region} not mapped; using us-east-1 defaults",
}
return _pricing_source
try:
import boto3
except ImportError:
_pricing_source = {
"source": "static_fallback",
"region": region,
"note": "boto3 not installed",
}
return _pricing_source
try:
pricing = boto3.client("pricing", region_name="us-east-1")
live_instances = 0
filters = [
{"Type": "TERM_MATCH", "Field": "databaseEngine", "Value": "Aurora MySQL"},
{"Type": "TERM_MATCH", "Field": "location", "Value": location},
{"Type": "TERM_MATCH", "Field": "deploymentOption", "Value": "Single-AZ"},
{"Type": "TERM_MATCH", "Field": "termType", "Value": "OnDemand"},
]
for page in pricing.get_paginator("get_products").paginate(
ServiceCode="AmazonRDS", Filters=filters
):
for item_json in page["PriceList"]:
item = json.loads(item_json) if isinstance(item_json, str) else item_json
attrs = item.get("product", {}).get("attributes", {})
itype = attrs.get("instanceType", "")
if not itype.startswith("db."):
continue
if "IOOptimized" in attrs.get("usagetype", ""):
continue
for term in item.get("terms", {}).get("OnDemand", {}).values():
for dim in term.get("priceDimensions", {}).values():
try:
price = float(dim.get("pricePerUnit", {}).get("USD", "0"))
except (ValueError, TypeError):
continue
if price > 0:
INSTANCE_PRICES[itype] = price
live_instances += 1
# Storage + I/O pricing
storage_filters = [
{"Type": "TERM_MATCH", "Field": "databaseEngine", "Value": "Aurora MySQL"},
{"Type": "TERM_MATCH", "Field": "location", "Value": location},
{"Type": "TERM_MATCH", "Field": "productFamily", "Value": "Database Storage"},
{"Type": "TERM_MATCH", "Field": "termType", "Value": "OnDemand"},
]
for page in pricing.get_paginator("get_products").paginate(
ServiceCode="AmazonRDS", Filters=storage_filters
):
for item_json in page["PriceList"]:
item = json.loads(item_json) if isinstance(item_json, str) else item_json
attrs = item.get("product", {}).get("attributes", {})
usage = attrs.get("usagetype", "")
for term in item.get("terms", {}).get("OnDemand", {}).values():
for dim in term.get("priceDimensions", {}).values():
try:
price = float(dim.get("pricePerUnit", {}).get("USD", "0"))
except (ValueError, TypeError):
continue
if price <= 0:
continue
if "IOOptimized" in usage:
STORAGE_IO_OPT_PER_GIB = price
elif "Aurora:StorageUsage" in usage:
STORAGE_STANDARD_PER_GIB = price
elif "Aurora:StorageIOUsage" in usage:
IO_COST_PER_MILLION = price * 1_000_000 # per-request -> per-million
_pricing_source = {
"source": "live",
"region": region,
"live_instances": live_instances,
"storage_standard": STORAGE_STANDARD_PER_GIB,
"storage_io_opt": STORAGE_IO_OPT_PER_GIB,
"io_per_million": IO_COST_PER_MILLION,
}
except Exception as e:
_pricing_source = {"source": "static_fallback", "region": region, "error": str(e)}
return _pricing_source
# ---------------------------------------------------------------------------
# Core calculation (shared by live and offline paths)
# ---------------------------------------------------------------------------
def compute_comparison(
compute_monthly: float,
storage_gib: float,
monthly_io_millions: float,
) -> dict:
"""Return Standard vs I/O-Optimized comparison and recommendation."""
storage_std = storage_gib * STORAGE_STANDARD_PER_GIB
io_cost = monthly_io_millions * IO_COST_PER_MILLION
total_std = compute_monthly + storage_std + io_cost
compute_io_opt = compute_monthly * IO_OPT_COMPUTE_MULTIPLIER
storage_io_opt = storage_gib * STORAGE_IO_OPT_PER_GIB
total_io_opt = compute_io_opt + storage_io_opt
io_pct = (io_cost / total_std * 100) if total_std > 0 else 0
savings = total_std - total_io_opt
# Drive the recommendation off the ACTUAL dollar savings, not the 25% heuristic
# alone — near the breakeven boundary the two diverge, and gating purely on the
# threshold can recommend I/O-Optimized while it actually costs more (and print a
# nonsensical "saves $-N/mo"). The 25% rule is a useful rule-of-thumb but the real
# decision is whether the I/O charges eliminated exceed the compute+storage premium.
threshold_note = (
f"I/O is {io_pct:.0f}% of total cost "
f"({'≥' if io_pct >= IO_OPT_BREAKEVEN_PCT else 'below '}{IO_OPT_BREAKEVEN_PCT:.0f}% rule-of-thumb)."
)
if savings > 0:
rec = "io_optimized"
reason = f"{threshold_note} I/O-Optimized saves ${savings:.0f}/mo."
else:
rec = "standard"
reason = f"{threshold_note} I/O-Optimized would cost ${abs(savings):.0f}/mo more."
return {
"standard": {
"compute_monthly": round(compute_monthly, 2),
"storage_monthly": round(storage_std, 2),
"io_monthly": round(io_cost, 2),
"total_monthly": round(total_std, 2),
},
"io_optimized": {
"compute_monthly": round(compute_io_opt, 2),
"storage_monthly": round(storage_io_opt, 2),
"io_monthly": 0.0,
"total_monthly": round(total_io_opt, 2),
},
"monthly_io_millions": round(monthly_io_millions, 1),
"storage_gib": round(storage_gib, 1),
"io_cost_pct_of_total": round(io_pct, 1),
"savings_with_io_opt": round(savings, 2),
"recommendation": rec,
"reason": reason,
}
def data_quality_tag(days: float) -> str:
if days < 3:
return "insufficient"
if days < 7:
return "short"
if days < 14:
return "adequate"
return "good"
# ---------------------------------------------------------------------------
# Live AWS path
# ---------------------------------------------------------------------------
def _sum_metric(cw, cluster_id: str, metric: str, start: dt.datetime, end: dt.datetime) -> float:
"""Sum a CloudWatch metric over the window. Returns total."""
resp = cw.get_metric_statistics(
Namespace="AWS/RDS",
MetricName=metric,
Dimensions=[{"Name": "DBClusterIdentifier", "Value": cluster_id}],
StartTime=start,
EndTime=end,
Period=3600,
Statistics=["Sum"],
)
return sum(dp.get("Sum", 0) for dp in resp.get("Datapoints", []))
def _avg_metric(cw, cluster_id: str, metric: str, start: dt.datetime, end: dt.datetime) -> float:
"""Average a CloudWatch metric over the window."""
resp = cw.get_metric_statistics(
Namespace="AWS/RDS",
MetricName=metric,
Dimensions=[{"Name": "DBClusterIdentifier", "Value": cluster_id}],
StartTime=start,
EndTime=end,
Period=3600,
Statistics=["Average"],
)
dps = resp.get("Datapoints", [])
return (sum(dp.get("Average", 0) for dp in dps) / len(dps)) if dps else 0.0
def _is_empty_cluster(cluster: dict) -> bool:
"""Skip clusters with no compute to analyze.
An Aurora cluster with no DB instances has no compute cost to compare. The
genuine cause is a cluster whose last writer/reader instance was deleted.
Note: an auto-paused (scale-to-zero) Aurora
serverless instance still appears in DBClusterMembers and is analyzable, so
it is NOT an empty cluster. The cost comparison doesn't apply here — skip.
"""
return len(cluster.get("DBClusterMembers", [])) == 0
def analyze_cluster_live(cluster_id: str, region: str, days: int) -> dict:
"""Analyze a single cluster using live AWS APIs."""
import boto3
rds = boto3.client("rds", region_name=region)
cw = boto3.client("cloudwatch", region_name=region)
# Cluster metadata
resp = rds.describe_db_clusters(DBClusterIdentifier=cluster_id)
clusters = resp.get("DBClusters", [])
if not clusters:
return {"cluster_id": cluster_id, "error": "cluster not found"}
cluster = clusters[0]
current_storage_type = cluster.get("StorageType", "aurora") # 'aurora' or 'aurora-iopt1'
engine = cluster.get("Engine", "")
# Guardrail: skip clusters with no DB instances (last instance deleted / paused)
if _is_empty_cluster(cluster):
return {
"cluster_id": cluster_id,
"engine": engine,
"engine_version": cluster.get("EngineVersion", ""),
"current_storage_type": current_storage_type,
"skipped": True,
"reason": (
"Cluster has no DB instances — no compute to analyze. "
"This usually means the cluster's last writer/reader instance "
"was deleted. The Standard vs I/O-Optimized comparison does not "
"apply until the cluster has a running instance."
),
}
# Get instance types in the cluster
member_ids = [m["DBInstanceIdentifier"] for m in cluster.get("DBClusterMembers", [])]
compute_monthly = 0.0
instance_summary = []
compute_warnings = []
for mid in member_ids:
try:
inst_resp = rds.describe_db_instances(DBInstanceIdentifier=mid)
for inst in inst_resp.get("DBInstances", []):
itype = inst.get("DBInstanceClass", "")
# Aurora Serverless v2 (db.serverless) has no fixed hourly rate — it bills
# per-ACU-hour from a CloudWatch metric, not from INSTANCE_PRICES. Counting it
# at $0 would silently understate compute and skew the I/O-cost percentage, so
# exclude it and flag the estimate as partial rather than emit a wrong number.
if itype == "db.serverless":
instance_summary.append(
{"id": mid, "type": itype, "note": "serverless_excluded"}
)
compute_warnings.append(
f"{mid} is Aurora Serverless v2 (db.serverless) — its ACU-based compute "
"cost is not included (it has no fixed hourly rate); the Standard vs "
"I/O-Optimized compute figures below cover provisioned instances only."
)
continue
price = INSTANCE_PRICES.get(itype, 0.0)
if price == 0.0:
# Unknown/unpriced provisioned type — don't silently add $0.
instance_summary.append({"id": mid, "type": itype, "note": "unknown_price"})
compute_warnings.append(
f"{mid} ({itype}) has no known hourly price in the static/live table — "
"excluded from the compute estimate; results are partial."
)
continue
compute_monthly += price * HOURS_PER_MONTH
instance_summary.append({"id": mid, "type": itype, "price_hr": price})
except Exception as e:
instance_summary.append({"id": mid, "error": str(e)})
# CloudWatch window
end = dt.datetime.now(dt.timezone.utc).replace(minute=0, second=0, microsecond=0)
start = end - dt.timedelta(days=days)
observed_hours = days * 24
read_io = _sum_metric(cw, cluster_id, "VolumeReadIOPs", start, end)
write_io = _sum_metric(cw, cluster_id, "VolumeWriteIOPs", start, end)
total_io = read_io + write_io
# Extrapolate to 730-hour month
monthly_io = (total_io / observed_hours * HOURS_PER_MONTH) if observed_hours > 0 else 0
monthly_io_millions = monthly_io / 1_000_000
# Storage (average)
avg_bytes = _avg_metric(cw, cluster_id, "VolumeBytesUsed", start, end)
storage_gib = avg_bytes / (1024**3) # Aurora bills actual usage; no fixed minimum
comparison = compute_comparison(compute_monthly, storage_gib, monthly_io_millions)
result = {
"cluster_id": cluster_id,
"engine": engine,
"current_storage_type": current_storage_type,
"instances": instance_summary,
"lookback_days": days,
"data_quality": data_quality_tag(days),
"observed_io_total": int(total_io),
**comparison,
}
if compute_warnings:
result["compute_partial"] = True
result["compute_warnings"] = compute_warnings
return result
def list_clusters(region: str) -> list[str]:
import boto3
rds = boto3.client("rds", region_name=region)
names = []
for page in rds.get_paginator("describe_db_clusters").paginate():
for c in page.get("DBClusters", []):
if c.get("Engine", "").startswith("aurora"):
names.append(c["DBClusterIdentifier"])
return names
# ---------------------------------------------------------------------------
# Offline path (no AWS calls)
# ---------------------------------------------------------------------------
def analyze_offline(
instance: str,
num_instances: int,
storage_gib: float,
monthly_io_millions: float,
) -> dict:
if instance not in INSTANCE_PRICES:
return {
"error": f"Unknown instance type: {instance}. "
f"Supported: {', '.join(sorted(INSTANCE_PRICES))}"
}
compute_monthly = INSTANCE_PRICES[instance] * HOURS_PER_MONTH * num_instances
comparison = compute_comparison(compute_monthly, storage_gib, monthly_io_millions)
return {
"cluster_id": "offline-input",
"instance_type": instance,
"num_instances": num_instances,
"data_quality": "user_supplied",
**comparison,
}
# ---------------------------------------------------------------------------
# CLI
# ---------------------------------------------------------------------------
def main():
parser = argparse.ArgumentParser(description="Aurora I/O-Optimized vs Standard cost analyzer")
parser.add_argument("--region", default="us-east-1")
parser.add_argument(
"--days", type=int, default=14, help="CloudWatch lookback window (default 14)"
)
parser.add_argument("--format", choices=["json", "table"], default="json")
# Modes are positional/optional
parser.add_argument("--cluster", help="Analyze a single cluster by identifier")
parser.add_argument(
"--all", action="store_true", help="Analyze all Aurora clusters in the region"
)
sub = parser.add_subparsers(dest="mode")
off = sub.add_parser("offline", help="Use user-supplied numbers, no AWS calls")
off.add_argument("--instance", required=True)
off.add_argument("--num-instances", type=int, default=1)
off.add_argument("--storage-gib", type=float, required=True)
off.add_argument("--monthly-io-millions", type=float, required=True)
# --region / --format are already defined on the main parser. Re-declare them on
# the offline subparser so they are ALSO accepted after the subcommand, but with
# SUPPRESSed defaults so a copy doesn't clobber a value passed before 'offline';
# the real default is resolved once, post-parse, below.
off.add_argument("--region", default=argparse.SUPPRESS)
off.add_argument("--format", choices=["json", "table"], default=argparse.SUPPRESS)
args = parser.parse_args()
if not hasattr(args, "region") or args.region is None:
args.region = "us-east-1"
if not hasattr(args, "format") or args.format is None:
args.format = "json"
# Offline mode
if args.mode == "offline":
# Still attempt to refresh pricing so regional factors can apply
refresh_pricing(args.region)
result = analyze_offline(
args.instance, args.num_instances, args.storage_gib, args.monthly_io_millions
)
result["pricing_source"] = _pricing_source
_emit(result, args.format)
return
# Live modes require boto3
try:
import boto3 # noqa: F401
except ImportError:
print(
"ERROR: boto3 required for live AWS analysis. Install boto3 or use the 'offline' subcommand.",
file=sys.stderr,
)
sys.exit(2)
refresh_pricing(args.region)
if args.all:
cluster_ids = list_clusters(args.region)
if not cluster_ids:
print(json.dumps({"status": "ok", "region": args.region, "clusters": []}, indent=2))
return
results = [analyze_cluster_live(cid, args.region, args.days) for cid in cluster_ids]
summary = _fleet_summary(results)
output = {
"region": args.region,
"pricing_source": _pricing_source,
"summary": summary,
"clusters": results,
}
_emit(output, args.format, fleet=True)
return
if args.cluster:
result = analyze_cluster_live(args.cluster, args.region, args.days)
result["pricing_source"] = _pricing_source
_emit(result, args.format)
return
parser.print_help()
def _fleet_summary(results: list[dict]) -> dict:
# Exclude errored and skipped clusters (no-instance) from dollar totals
analyzable = [r for r in results if "error" not in r and not r.get("skipped")]
skipped = [r for r in results if r.get("skipped")]
total_std = sum(r.get("standard", {}).get("total_monthly", 0) for r in analyzable)
total_io_opt = sum(r.get("io_optimized", {}).get("total_monthly", 0) for r in analyzable)
switch_wins = [r["cluster_id"] for r in analyzable if r.get("recommendation") == "io_optimized"]
return {
"cluster_count": len(results),
"analyzable_count": len(analyzable),
"skipped_count": len(skipped),
"skipped_clusters": [
{"cluster_id": r["cluster_id"], "reason": r.get("reason", "")} for r in skipped
],
"clusters_that_should_switch": switch_wins,
"current_monthly_total_standard": round(total_std, 2),
"if_all_on_io_optimized_monthly": round(total_io_opt, 2),
"optimal_savings_monthly": round(
sum(max(0, r.get("savings_with_io_opt", 0)) for r in analyzable),
2,
),
}
def _emit(result: dict, fmt: str, fleet: bool = False) -> None:
if fmt == "json":
print(json.dumps(result, indent=2, default=str))
return
# Table format
if fleet:
s = result["summary"]
print(
f"Region: {result['region']} Clusters: {s['cluster_count']} "
f"(analyzable: {s['analyzable_count']}, skipped: {s['skipped_count']})"
)
print(f" Current (Standard): ${s['current_monthly_total_standard']:.0f}/mo")
print(f" All on I/O-Optimized: ${s['if_all_on_io_optimized_monthly']:.0f}/mo")
print(f" Optimal (switch winners): saves ${s['optimal_savings_monthly']:.0f}/mo")
print(f" Clusters to switch: {', '.join(s['clusters_that_should_switch']) or '(none)'}")
if s.get("skipped_clusters"):
print(f" Skipped (not applicable):")
for sc in s["skipped_clusters"]:
print(f" - {sc['cluster_id']}: {sc['reason'][:80]}")
print()
print(f"{'Cluster':<30} {'I/O %':>6} {'Std $/mo':>10} {'IOOpt $/mo':>12} {'Rec':>14}")
print("-" * 76)
for r in result["clusters"]:
if "error" in r:
print(f"{r['cluster_id']:<30} ERROR: {r['error']}")
continue
if r.get("skipped"):
print(
f"{r['cluster_id']:<30} {'—':>6} {'—':>10} {'—':>12} {'skipped (no instances)':>22}"
)
continue
print(
f"{r['cluster_id']:<30} {r['io_cost_pct_of_total']:>5.0f}% "
f"{r['standard']['total_monthly']:>10.0f} "
f"{r['io_optimized']['total_monthly']:>12.0f} "
f"{r['recommendation']:>14}"
)
return
# Single cluster
r = result
if r.get("skipped"):
print(f"Cluster: {r.get('cluster_id', '?')}")
print(f" Engine: {r.get('engine', '?')} {r.get('engine_version', '')}")
print(f" Status: SKIPPED — not applicable")
print(f" {r.get('reason', '')}")
return
print(f"Cluster: {r.get('cluster_id', '?')} ({r.get('data_quality', '?')} data)")
print(f" Current storage type: {r.get('current_storage_type', '?')}")
print(f" Monthly I/O: {r.get('monthly_io_millions', 0):.0f}M requests")
print(f" Storage: {r.get('storage_gib', 0):.0f} GiB")
print()
std = r["standard"]
ioo = r["io_optimized"]
print(f" {'Component':<12} {'Standard':>12} {'I/O-Optimized':>15}")
print(f" {'Compute':<12} {std['compute_monthly']:>12.0f} {ioo['compute_monthly']:>15.0f}")
print(f" {'Storage':<12} {std['storage_monthly']:>12.0f} {ioo['storage_monthly']:>15.0f}")
print(f" {'I/O':<12} {std['io_monthly']:>12.0f} {ioo['io_monthly']:>15.0f}")
print(f" {'Total':<12} {std['total_monthly']:>12.0f} {ioo['total_monthly']:>15.0f}")
print()
print(f" I/O cost: {r['io_cost_pct_of_total']:.0f}% of total")
print(f" Recommendation: {r['recommendation'].upper()}")
print(f" {r['reason']}")
if __name__ == "__main__":
main()
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server, Needs Python
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- AWS
- Publisher
- AWS (Official)
- Source
- aws/agent-toolkit-for-aws · skills/specialized-skills/database-skills/amazon-aurora-mysql · commit 0a218f8
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- NOTICE (added by AutoGineer from NOTICE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by AWS or AWS.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download amazon-aurora-mysql.zip