AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The rds-oss skill provides comprehensive guidance for managing Amazon RDS open-source engines. It covers five core areas: production-ready instance provisioning, upgrade planning, commitment pricing analysis, RDS Proxy evaluation, and Blue/Green deployment orchestration. The skill emphasizes production best practices, such as TLS enforcement, KMS encryption, and automated password management, while providing clear decision frameworks for complex tasks like zero-downtime DDL changes and connection pooling strategies.
What it does
- Generates production-ready CLI commands for provisioning RDS instances with security best practices.
- Provides step-by-step upgrade workflows, including pre-upgrade checklists and version compatibility analysis.
- Analyzes cost-saving opportunities between Reserved Instances and Database Savings Plans.
- Evaluates the necessity of RDS Proxy versus existing connection pooling solutions like PgBouncer.
- Orchestrates Blue/Green deployment planning, including DDL compatibility assessment and switchover procedures.
- Offers expert guidance on RDS-specific configurations, distinguishing them from Aurora-specific features.
When to use it
- When you need to provision a new RDS MySQL, MariaDB, or PostgreSQL instance following AWS production standards.
- When planning a major version upgrade and requiring a pre-check workflow to identify potential regressions.
- When evaluating the financial impact of commitment-based pricing models for steady-state database workloads.
- When troubleshooting connection bottlenecks and deciding between RDS Proxy and alternative pooling solutions.
- When performing complex schema changes or major upgrades with a requirement for minimal downtime.
Advantages
- Ensures adherence to security and operational best practices by default.
- Provides clear, actionable CLI commands for complex AWS RDS operations.
- Prevents common configuration errors by distinguishing between RDS and Aurora semantics.
- Offers structured, risk-aware workflows for sensitive operations like Blue/Green switchovers.
- Reduces manual research time by centralizing upgrade paths and pricing analysis logic.
Usage examples
- “Create a production-ready RDS MySQL instance.”
- The agent provides a comprehensive AWS CLI command incorporating Multi-AZ, encryption, performance insights, and Secrets Manager integration.
- “Should I buy reserved instances or a savings plan for my db.r7g.2xlarge RDS MySQL?”
- The agent performs a comparative analysis of On-Demand, RI, and DSP options, providing a savings breakdown and recommending the 3yr RI based on usage.
- “How do I change a VARCHAR to INT column on RDS MySQL 8.0 with Blue/Green?”
- The agent explains why this DDL breaks binlog replication, outlines the required Blue/Green lifecycle, and provides the specific CLI commands for deployment and switchover.
- “Does RDS Proxy help when PgBouncer already runs in transaction mode?”
- The agent clarifies the marginal benefit of multiplexing in this scenario while highlighting the unique advantages of RDS Proxy like IAM auth and managed failover.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/aws/rds-oss/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip rds-oss.zip -d .agents/skills
Documentation by AWS
RDS OSS Advisor (MySQL, MariaDB, PostgreSQL)
Overview
Advisor for Amazon RDS on the open-source engines — MySQL, MariaDB, and PostgreSQL. Five decision areas:
Instance creation — provision production-ready instances with best-practice defaults (latest version, Multi-AZ, encryption, Performance Insights, Secrets Manager password management)
Upgrade planning — identify instance, enumerate targets, run live prechecks, flag plan regressions, surface pre/post checklists
Commitment pricing — estimate RI and Database Savings Plan savings for steady workloads
RDS Proxy evaluation — decide whether proxy is worth it, based on connection utilization and pinning risks
Blue/Green deployments — plan low-downtime DDL or major upgrades, with DDL compatibility analysis
Produces cost estimates, precheck findings, and CLI commands. For instance creation, executes the create-db-instance call with production best practices. For upgrades, purchases, and switchovers — advisory only, never executes without explicit user confirmation.
Scoped to RDS open-source engines. For Aurora, use amazon-aurora. For Oracle, SQL Server, Db2, use the engine-specific skills.
The AWS MCP server is recommended for executing commands but is not required; all operations can also be performed via the AWS CLI.
Decision Guide
| User asks about… | Go to |
|---|---|
| Create, provision, or set up a new RDS MySQL/MariaDB/PostgreSQL instance | Production Instance Creation below |
| Upgrade, target version, pre/post-upgrade checklist, upgrade prechecks, Read Replica upgrade order | references/upgrade-workflow.md |
| Reserved Instance, RI, Database Savings Plan, DSP, 1yr vs 3yr, Multi-AZ commitment, No/Partial/All Upfront | references/commitment-pricing-workflow.md |
| RDS Proxy, connection pooling, too many connections, Lambda DB connections, proxy pinning, PgBouncer vs Proxy | references/proxy-advisor-workflow.md |
| Blue/Green, zero-downtime DDL, switchover, schema change with minimal downtime, type change on production | references/bluegreen-advisor-workflow.md |
Broad request ("help me with RDS")? Present the five options as one line each. If the user supplied an instance ID, offer a general health check (engine + version + connection utilization) as entry point.
Out-of-scope (Aurora, Oracle, SQL Server, Db2, backup policy, Performance Insights deep-dive analysis): answer from general knowledge, note this skill doesn't cover it, point to the right engine-specific skill.
RDS vs Aurora — Do Not Confuse
RDS open-source engines and Aurora are different products with different semantics. You MUST NOT apply Aurora concepts to RDS:
| Concept | RDS (this skill) | Aurora (use amazon-aurora) |
|---|---|---|
| LTS releases | ❌ Does not exist | ✅ Has LTS versions |
| Serverless mode | ❌ Does not exist | ✅ Aurora Serverless |
| I/O-Optimized storage | ❌ Does not exist | ✅ aurora-iopt1 |
| Data API | ❌ Not available for standalone RDS | ✅ Aurora Serverless clusters |
| Instance topology | Instance-based (describe-db-instances) | Cluster-based (describe-db-clusters) |
| Upgrade scope | Per-instance | Per-cluster (writer + readers together) |
| DSP term options | 1yr and 3yr | 1yr only |
| Pricing model | On-Demand + RI + DSP | On-Demand + RI + DSP + I/O pricing |
If a user asks about any Aurora-specific concept, route to amazon-aurora. If an instance turns out to be Aurora (engine = aurora-mysql or aurora-postgresql), stop and redirect.
Production Instance Creation
When a user asks to create or provision a new RDS MySQL, MariaDB, or PostgreSQL instance for production use, you MUST apply the following best practices by default:
Use the latest stable major version — run
aws rds describe-db-engine-versions --engine <engine> --query "DBEngineVersions[].EngineVersion"to find the latest. For MySQL, prefer 8.4.x over 8.0 (8.0 has an earlier end-of-standard-support date than 8.4 — see RDS Extended Support for dates). For PostgreSQL, use the latest major. For MariaDB, use the latest major.Enable Multi-AZ — set
--multi-azfor automatic failover.Enable storage encryption using a customer-managed KMS key — set
--storage-encrypted --kms-key-id <key-arn>. A customer-managed key gives full control over key rotation, access policies, and cross-account sharing.Disable public access — set
--no-publicly-accessibleto ensure the instance is not accessible from the internet.Set backup retention to 7 days — set
--backup-retention-period 7.Enable Performance Insights with 7-day retention — set
--enable-performance-insights --performance-insights-retention-period 7. If Performance Insights captures queries containing sensitive data (e.g., literal values in WHERE clauses), specify--performance-insights-kms-key-id <key-arn>to encrypt at rest with a customer-managed KMS key.Enable deletion protection — set
--deletion-protection.Avoid default master usernames — do NOT use well-known names like
admin,root,postgres, ormaster, which make credential-guessing attacks easier. Choose a custom--master-username(e.g., an application- or team-specific name).Manage master password via Secrets Manager — set
--manage-master-user-passwordinstead of providing a plaintext--master-user-password. This creates and rotates the password automatically in Secrets Manager. Do NOT accept or use a plaintext password for production instances.Use gp3 storage — set
--storage-type gp3. It's cheaper and faster than gp2 with no minimum IOPS purchase.Tag the instance so customers can identify resources created via this skill — set
--tags Key=created_by,Value=rds-oss-skill Key=generation_model,Value={your-model-id}(see Resource tagging below).Enforce TLS for connections in transit — create or modify the DB parameter group to require encrypted connections:
require_secure_transport=ONfor MySQL/MariaDB,rds.force_ssl=1for PostgreSQL.Export database logs to CloudWatch Logs and encrypt with KMS — set
--enable-cloudwatch-logs-exportsso database-level security events (failed logins, suspicious queries) are centrally visible. Use["error","slowquery","audit"]for MySQL/MariaDB (note: theauditstream requires audit logging to be enabled first, otherwise it is empty — on RDS MySQL via the MARIADB_AUDIT_PLUGIN in an Option Group, on RDS MariaDB via the built-in server audit parameters such asserver_audit_logging=1in a parameter group) and["postgresql"]for PostgreSQL. Database logs can contain SQL with literal values and usernames, so you MUST configure a KMS key on the resulting/aws/rds/instance/<name>/*log groups to protect sensitive data at rest.
Example CLI (MySQL 8.4, production-ready):
aws rds create-db-instance \
--db-instance-identifier <name> \
--engine mysql \
--engine-version 8.4 \
--db-instance-class <class> \
--allocated-storage 100 \
--storage-type gp3 \
--storage-encrypted \
--kms-key-id <kms-key-arn> \
--no-publicly-accessible \
--multi-az \
--manage-master-user-password \
--master-username <custom-non-default-username> \
--backup-retention-period 7 \
--enable-performance-insights \
--performance-insights-retention-period 7 \
--performance-insights-kms-key-id <kms-key-arn> \
--deletion-protection \
--enable-cloudwatch-logs-exports '["error","slowquery","audit"]' \
--tags Key=created_by,Value=rds-oss-skill Key=generation_model,Value=<your-model-id> \
--region us-east-1After instance creation, run the following commands to configure TLS enforcement and log group encryption (these are user-executed steps that the skill presents but does not invoke directly):
# Create a custom parameter group with TLS enforcement (MySQL example)
aws rds create-db-parameter-group --db-parameter-group-family mysql8.4 \
--db-parameter-group-name <name>-tls --description "TLS enforced"
aws rds modify-db-parameter-group --db-parameter-group-name <name>-tls \
--parameters "ParameterName=require_secure_transport,ParameterValue=ON,ApplyMethod=pending-reboot"
aws rds modify-db-instance --db-instance-identifier <name> \
--db-parameter-group-name <name>-tls --apply-immediately
# Encrypt CloudWatch Logs log groups with KMS
aws logs associate-kms-key --log-group-name /aws/rds/instance/<name>/error --kms-key-id <kms-key-arn>
aws logs associate-kms-key --log-group-name /aws/rds/instance/<name>/slowquery --kms-key-id <kms-key-arn>Constraints:
You MUST use
--manage-master-user-passwordfor production. NEVER use--master-user-passwordwith a plaintext password for production instances.You MUST check the latest available engine version via
describe-db-engine-versionsrather than hardcoding a version.You MUST enable Multi-AZ, encryption, Performance Insights (7-day), backup retention (7 days), and deletion protection unless the user explicitly says otherwise.
If the user says "production" or "production-ready", apply ALL of the above without asking.
Resource tagging (always apply on resource creation)
When creating any RDS instance (create-db-instance), ALWAYS include these tags using the RDS list-of-records --tags syntax:
--tags Key=created_by,Value=rds-oss-skill Key=generation_model,Value={your-model-id}
Example: --tags Key=created_by,Value=rds-oss-skill Key=generation_model,Value=claude-sonnet-4-20250514
Include these tags even if the user does not mention tagging, so that they can identify the resources created via this skill. If the user provides additional tags, append these to their tags rather than replacing them. The same applies when tagging via add-tags-to-resource or during blue/green deployments.
Common Tasks
1. Verify Dependencies
See references/verify-dependencies.md for tool and credential requirements before running workflows.
2. Classify and Route
Use the Decision Guide to choose a workflow reference, the catalog presentation (broad requests), or a general-knowledge answer (out-of-scope).
Constraints:
You MUST name the workflow you're routing to
You MUST pass along instance ID, region, engine, or workload details the user already supplied — do not re-ask
You MAY ask one clarifying question if a request straddles two workflows (e.g., "upgrade with minimal downtime" = upgrade + Blue/Green)
You MUST NOT route Aurora, Oracle, SQL Server, or Db2 questions here — those engines have different tooling
3. Execute the Workflow
Load the matching reference and follow its ## Tasks section.
Constraints:
You MUST explain what step is executing and which tool is being called before running it
You MUST NOT execute
modify-*,switchover-*, purchase APIs, orcreate-db-proxy. Allowed:create-db-instance(for new instance provisioning),describe-*,list-*,get-*,send-commandfor SSM prechecks.You MUST NOT handle DB credentials directly. Use user-supplied secret ARNs, pre-configured SSM parameters, or ask the user to paste script output.
When a live call or bundled script cannot run, You MUST report the exact blocker and either execute the offline fallback or ask the user for inputs. You MUST NOT fabricate command output, analyzer results, pricing numbers, or version lists — a plausible-looking answer with no factual basis is worse than refusing, because users act on it.
If multiple workflows ran, close with a 2–4 line synthesis linking to prior outputs.
Each workflow reference includes its own tool-call examples.
Critical Facts to Always Surface
These RDS-OSS-specific facts are what distinguish this skill from vanilla MySQL/PostgreSQL/MariaDB knowledge. General answers typically conflate RDS with Aurora, omit the CLI command names, or stray into action-taking when this is an advisory skill.
For "run the RDS upgrade advisor for my RDS MySQL instance", you MUST tell the user ALL of the following five facts:
Identify the instance via
aws rds describe-db-instances(NOTdescribe-db-clusters— RDS MySQL/MariaDB/PostgreSQL are instance-based, not cluster-based;describe-db-clustersis only for Aurora).Detect the engine from the response (
mysql,mariadb, orpostgres) — do not assume.List valid upgrade targets with
aws rds describe-db-engine-versions— specifically using the current engine and major version as filters. This is how you enumerate the allowed upgrade paths.Present the latest version recommendation explicitly (e.g., "8.0.40 is the latest 8.0 minor, 8.4.x is the next major").
Do NOT mention LTS — RDS has no LTS concept (see RDS vs Aurora). Offering LTS advice indicates routing confusion between RDS and Aurora. Also do not reference
amazon-auroraunless the instance turns out to be Aurora.
Critical workflow rule — when the named instance cannot be located: if describe-db-instances --db-instance-identifier <id> returns no results or a DBInstanceNotFoundFault, you MUST still walk through the full advisor workflow for the user — name each step (describe-db-instances, then engine detection, then describe-db-engine-versions, then version recommendation, then pre-upgrade checklist) — and explain what the output would look like at each step. DO NOT bail out asking "could you double-check the instance ID?" and stop. The user is asking for the advisor procedure, not for you to perform live discovery. If you cannot see the instance, present the workflow as a template the user can run once the correct identifier is supplied.
For "upgrade my RDS MariaDB from X to the latest version", you MUST tell the user ALL of the following six facts:
Detect engine as
mariadbvia describe-db-instances.Use
describe-db-engine-versions(with--engine mariadb) to identify target versions, not a hand-maintained list.Offer SSM or direct-connection precheck methods — RDS MariaDB can be prechecked via SSM Run Command on a client host or via direct mysql-client connection.
DO NOT use RDS Data API — MariaDB does not support the Data API. This is the classic trap. Data API is only for Aurora Serverless and a subset of clusters, never MariaDB on RDS.
Run MySQL-compatible precheck queries from upgrade-prechecks-mysql.md — removed features, reserved keywords,
sql_modechanges. MariaDB reuses the MySQL precheck set because it's a MySQL fork.Decline to execute the upgrade — advisor only. Recommend a snapshot-and-restore dry-run in a test environment before proceeding. Explicitly say you will not run
modify-db-instance --engine-version.
For "2x db.r7g.2xlarge RDS MySQL 24/7 — buy RI or Savings Plan?", you MUST tell the user ALL of the following seven facts:
Run rds_commitment_pricing_analyzer.py offline with
--instance-type db.r7g.2xlarge --engine mysql --num-instances 2. Print the exact command as a fenced bash block.Present a full comparison table of all five options — On-Demand, 1yr RI, 3yr RI, 1yr DSP, 3yr DSP — with savings vs on-demand in both dollars and percentage for each.
Recommend 3yr RI given the stated 2+-year confidence and 24/7 usage.
Explain that RDS Database Savings Plan covers the r7g family specifically — DSP coverage is family-scoped, not instance-scoped, which is a key advantage if the user might resize within the family.
Mention the 3yr lock-in tradeoff — if workload changes or the family gets superseded, the commitment is not recoverable in full.
Note that RDS RIs are region-locked — moving the workload cross-region would forfeit the RI benefit.
DO NOT include purchase action steps — no "Next Steps" section with purchase directions. No "go to Console → Reserved Instances → Purchase". No
aws rds purchase-reserved-db-instances-offeringoraws savingsplans create-savings-plancommands. This is a hard ban. This skill is advisory-only and MUST NOT guide users toward executing purchases. Say "When you're ready to purchase, refer to the AWS console or CLI docs." and stop there. Do NOT try to be helpful by showing what the purchase command would look like "for reference."
For "change a VARCHAR(10) column to INT on RDS MySQL 8.0 via Blue/Green", you MUST tell the user ALL of the following seven facts:
Validate prerequisites first:
binlog_format=ROW, automated backups enabled (retention > 0), instance inavailablestate.Explain why MODIFY COLUMN changing type breaks binlog replication: Blue/Green replicates the blue → green by replaying binlog events. A type change produces a different binary representation on the two sides, so replication events recorded against VARCHAR can't be applied to an INT column. This is the root cause, not a "row format" issue.
Create the green environment with
aws rds create-blue-green-deployment— include the exact CLI command name, not a generic description.Let green catch up via binlog replication before the DDL.
Apply the schema change on green (the MODIFY COLUMN DDL) once green has caught up.
Switch over immediately with
aws rds switchover-blue-green-deployment— do not let green run in parallel with blue after the incompatible DDL. The schema divergence breaks further replication.Verify the schema change on the production endpoint after switchover and you MUST pause and ask the user for explicit confirmation before presenting the
switchover-blue-green-deploymentcommand, even as a suggested step. Do NOT list switchover as an automatic next step in a sequential workflow — state that the switchover is a destructive action that transfers production traffic, then ask "Are you ready to switch over? I'll give you the exact CLI command to run when you confirm." Only after the user confirms should you emit theswitchover-blue-green-deploymentcommand.
For "we run PgBouncer in transaction mode — would RDS Proxy add anything?", you MUST tell the user ALL of the following six facts:
PgBouncer in transaction mode already does aggressive connection multiplexing — that is the primary value proposition of Proxy. In this scenario the multiplexing benefit is marginal.
What RDS Proxy adds on top: managed infrastructure (no EC2 to operate or patch).
Built-in IAM authentication — RDS Proxy supports IAM auth natively, which PgBouncer does not out of the box.
Automatic failover integrated with RDS events — Proxy reacts to RDS failover events in seconds; PgBouncer needs external health checks and manual reconfiguration.
Secrets Manager integration for credential rotation — Proxy can pull credentials from Secrets Manager and rotate without downtime.
Recommendation: if PgBouncer is working and none of the above four features are specifically desired, stay on PgBouncer. Switch to RDS Proxy only if IAM auth, managed failover, or Secrets-Manager-rotated credentials are specifically needed.
Security Considerations
Advisory skill — never modifies existing AWS resources. The only write action allowed is create-db-instance for new instance provisioning (see Production Instance Creation); everything else is read-only. Never handle credentials directly; prefer short-lived credentials.
Minimum IAM permissions required: AmazonRDSReadOnlyAccess + CloudWatchReadOnlyAccess + scoped pricing:GetProducts + savingsplans:DescribeSavingsPlansOfferingRates. For instance creation, also rds:CreateDBInstance + rds:AddTagsToResource, plus logs:CreateLogGroup if CloudWatch Logs exports are enabled. SSM prechecks also need ssm:SendCommand / ssm:GetCommandInvocation on the target bastion.
Apply these security practices in all guidance:
Encryption in transit — enforce TLS on all database connections (
require_secure_transport=ONfor MySQL/MariaDB,rds.force_ssl=1for PostgreSQL).IAM database authentication — prefer IAM auth over username/password for application connections where supported, providing short-lived credentials.
Audit logging — recommend enabling database audit logging (on RDS MySQL via the MARIADB_AUDIT_PLUGIN in an Option Group, on RDS MariaDB via the built-in server audit parameters such as
server_audit_logging=1, and thepgauditextension for PostgreSQL) and CloudTrail for API-level audit.VPC security — deploy instances in a private subnet. Security groups should restrict inbound access to specific application CIDR ranges or security group references — never
0.0.0.0/0.Credential rotation —
--manage-master-user-passwordprovides automatic rotation via Secrets Manager.Monitoring and alarms — recommend CloudWatch Alarms on security-relevant metrics, such as
DatabaseConnectionsspikes (possible credential compromise) andFreeableMemorydrops (possible resource-exhaustion attack).
Do NOT grant write/admin beyond the permissions listed above to work around permission errors. Do NOT store DB passwords in SSM parameters or command text — use Secrets Manager and retrieve the secret inside the command.
Troubleshooting
Access denied. Attach the read-only policies above.
Expired credentials. Refresh, or fall back to --offline for commitment pricing.
Timeouts / throttling. Retry once, then narrow scope. SSM precheck timeouts on large schemas: switch to direct connection or user-runs-script. RDS Data API is not available for standalone RDS.
Resource not found. Verify region/ID; confirm it's not an Aurora cluster (describe-db-clusters). Empty RI/DSP offerings — fall back to offline.
User asks to execute a change. Advisory skill — modifications to existing resources happen via the AWS console or user-run CLI.
Aurora question. Route to amazon-aurora. See RDS vs Aurora above.
Oracle / SQL Server / Db2 question. Route to rds-oracle, rds-sqlserver, or rds-db2.
Additional Resources
Files
- ATTRIBUTION.mdAdded by AutoGineer902 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer67 B
- SKILL.md24.3 KiB
- references/bluegreen-advisor-workflow.md7.0 KiB
- references/bluegreen-ddl-mysql.md2.2 KiB
- references/bluegreen-ddl-postgresql.md4.3 KiB
- references/commitment-basics.md2.5 KiB
- references/commitment-pricing-workflow.md5.5 KiB
- references/commitment-scenarios.md2.7 KiB
- references/proxy-advisor-workflow.md7.6 KiB
- references/proxy-pinning-mysql.md2.8 KiB
- references/proxy-pinning-postgresql.md4.4 KiB
- references/upgrade-post-checklist.md5.7 KiB
- references/upgrade-pre-checklist.md7.1 KiB
- references/upgrade-prechecks-mysql.md6.0 KiB
- references/upgrade-prechecks-postgresql.md5.3 KiB
- references/upgrade-query-load-mysql.md1.8 KiB
- references/upgrade-query-load-postgresql.md1.8 KiB
- references/upgrade-workflow.md8.6 KiB
- references/verify-dependencies.md935 B
- scripts/rds_commitment_pricing_analyzer.pyScript16.0 KiB
scripts/rds_commitment_pricing_analyzer.py
"""RDS Reserved Instance & Database Savings Plan estimator.
Read-only tool that fetches live RI and DSP rates from AWS and projects
monthly cost under each commitment option for RDS MySQL, MariaDB, and
PostgreSQL instances. No purchase APIs are ever called.
Usage:
python rds_commitment_pricing_analyzer.py --instance my-rds-db --region us-east-1
python rds_commitment_pricing_analyzer.py --region us-east-1 offline \
--instance-type db.r7g.2xlarge --engine mysql --num-instances 2
python rds_commitment_pricing_analyzer.py --region us-east-1 offline \
--instance-type db.r7g.2xlarge --engine postgres --multi-az
"""
from __future__ import annotations
import argparse
import json
import re
import sys
from dataclasses import dataclass
HOURS_PER_MONTH = 730
ENGINE_PRODUCT_MAP = {
"mysql": "MySQL",
"mariadb": "MariaDB",
"postgres": "PostgreSQL",
}
_STATIC_INSTANCE_PRICES = {
"db.t3.medium": 0.068,
"db.t3.large": 0.136,
"db.t4g.medium": 0.065,
"db.t4g.large": 0.129,
"db.m5.large": 0.171,
"db.m5.xlarge": 0.342,
"db.m5.2xlarge": 0.684,
"db.m6g.large": 0.154,
"db.m6g.xlarge": 0.308,
"db.m6g.2xlarge": 0.616,
"db.m7g.large": 0.162,
"db.m7g.xlarge": 0.324,
"db.m7g.2xlarge": 0.648,
"db.r5.large": 0.240,
"db.r5.xlarge": 0.480,
"db.r5.2xlarge": 0.960,
"db.r5.4xlarge": 1.920,
"db.r5.8xlarge": 3.840,
"db.r6g.large": 0.218,
"db.r6g.xlarge": 0.435,
"db.r6g.2xlarge": 0.870,
"db.r6g.4xlarge": 1.740,
"db.r6g.8xlarge": 3.480,
"db.r7g.large": 0.228,
"db.r7g.xlarge": 0.456,
"db.r7g.2xlarge": 0.912,
"db.r7g.4xlarge": 1.824,
"db.r7g.8xlarge": 3.648,
"db.r8g.large": 0.240,
"db.r8g.xlarge": 0.480,
"db.r8g.2xlarge": 0.960,
"db.r8g.4xlarge": 1.920,
"db.r8g.8xlarge": 3.840,
}
MULTI_AZ_MULTIPLIER = 2.0
_DSP_ELIGIBLE_FAMILIES = {"r7g", "r7i", "r8g", "r8gd", "m7g", "m7i", "c7g", "c7i", "x8g"}
_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-central-1": "EU (Frankfurt)",
"ap-southeast-1": "Asia Pacific (Singapore)",
"ap-northeast-1": "Asia Pacific (Tokyo)",
"ap-south-1": "Asia Pacific (Mumbai)",
}
@dataclass
class RIOffering:
instance_type: str
term_years: int
payment_option: str
effective_hourly: float
upfront_cost: float
recurring_hourly: float
multi_az: bool = False
def monthly_cost(self) -> float:
return self.effective_hourly * HOURS_PER_MONTH
@dataclass
class DSPRate:
usage_type: str
term_years: int
payment_option: str
rate_per_hour: float
def monthly_cost(self) -> float:
return self.rate_per_hour * HOURS_PER_MONTH
def _family_from_instance(instance_type: str) -> str:
m = re.match(r"db\.([a-z0-9]+)\.", instance_type)
return m.group(1) if m else ""
def get_on_demand_price(
instance_type: str, region: str = "us-east-1", multi_az: bool = False
) -> float:
price = _STATIC_INSTANCE_PRICES.get(instance_type, 0.0)
if region != "us-east-1" and price > 0:
# Static prices reflect us-east-1 only; actual price in other regions may differ
import warnings
warnings.warn(
f"On-demand price for {instance_type} is based on us-east-1. "
f"Actual price in {region} may differ."
)
if multi_az:
price *= MULTI_AZ_MULTIPLIER
return price
def fetch_ri_offerings(
instance_type: str, engine: str, region: str, multi_az: bool = False
) -> list[RIOffering]:
try:
import boto3
except ImportError:
return []
product_desc = ENGINE_PRODUCT_MAP.get(engine, "MySQL")
results: list[RIOffering] = []
try:
rds = boto3.client("rds", region_name=region)
paginator = rds.get_paginator("describe_reserved_db_instances_offerings")
for page in paginator.paginate(
DBInstanceClass=instance_type,
ProductDescription=product_desc,
MultiAZ=multi_az,
):
for offering in page.get("ReservedDBInstancesOfferings", []):
inst = offering.get("DBInstanceClass", "")
if inst != instance_type:
continue
duration = offering.get("Duration", 0)
term_years = 3 if duration > 94_000_000 else 1
payment = offering.get("OfferingType", "")
fixed = float(offering.get("FixedPrice", 0.0))
recurring_list = offering.get("RecurringCharges", [])
recurring_hr = sum(
float(rc.get("RecurringChargeAmount", 0.0)) for rc in recurring_list
)
term_hours = term_years * 365 * 24
effective = (fixed / term_hours) + recurring_hr
results.append(
RIOffering(
instance_type=inst,
term_years=term_years,
payment_option=payment,
effective_hourly=round(effective, 6),
upfront_cost=round(fixed, 2),
recurring_hourly=round(recurring_hr, 6),
multi_az=multi_az,
)
)
except Exception:
return []
seen = set()
deduped = []
for r in results:
key = (r.term_years, r.payment_option, round(r.effective_hourly, 6))
if key in seen:
continue
seen.add(key)
deduped.append(r)
return deduped
def fetch_dsp_rates(engine: str, region: str) -> dict[str, list[DSPRate]]:
try:
import boto3
except ImportError:
return {}
result: dict[str, list[DSPRate]] = {}
product_desc = ENGINE_PRODUCT_MAP.get(engine, "MySQL")
try:
sp = boto3.client("savingsplans", region_name="us-east-1")
rates = []
token = None
while True:
kwargs = {
"savingsPlanTypes": ["Database"],
"products": ["RDS"],
"serviceCodes": ["AmazonRDS"],
"filters": [
{"name": "region", "values": [region]},
{"name": "productDescription", "values": [product_desc]},
],
"maxResults": 1000,
}
if token:
kwargs["nextToken"] = token
resp = sp.describe_savings_plans_offering_rates(**kwargs)
rates.extend(resp.get("searchResults", []))
token = resp.get("nextToken")
if not token:
break
for rate_entry in rates:
offering = rate_entry.get("savingsPlanOffering", {})
dur = offering.get("durationSeconds", 0)
term_years = 3 if dur > 94_000_000 else 1
payment = offering.get("paymentOption", "")
try:
rate_val = float(rate_entry.get("rate", "0"))
except (ValueError, TypeError):
continue
if rate_val <= 0:
continue
usage = rate_entry.get("usageType", "")
# Usage types may carry a region prefix (e.g. "USE2-InstanceUsage:db.r7g.2xlarge"),
# so search anywhere in the string rather than anchoring at the start.
m = re.search(r"InstanceUsage:db\.(\w+)\.(\w+)", usage)
if not m:
continue
family = m.group(1)
size = m.group(2)
key = f"db.{family}.{size}"
entry = DSPRate(
usage_type=key,
term_years=term_years,
payment_option=payment,
rate_per_hour=round(rate_val, 6),
)
result.setdefault(key, []).append(entry)
except Exception:
pass
return result
def best_ri(offerings: list[RIOffering], term_years: int) -> RIOffering | None:
candidates = [r for r in offerings if r.term_years == term_years]
if not candidates:
return None
return min(candidates, key=lambda r: r.effective_hourly)
def best_dsp(rates: list[DSPRate], term_years: int = 1) -> DSPRate | None:
candidates = [r for r in rates if r.term_years == term_years]
if not candidates:
return None
return min(candidates, key=lambda r: r.rate_per_hour)
def build_comparison(
instance_type: str,
engine: str,
num_instances: int,
region: str,
multi_az: bool = False,
dsp_rates: dict[str, list[DSPRate]] | None = None,
) -> dict:
if dsp_rates is None:
dsp_rates = fetch_dsp_rates(engine, region)
family = _family_from_instance(instance_type)
od_hourly = get_on_demand_price(instance_type, region, multi_az)
od_monthly = od_hourly * HOURS_PER_MONTH * num_instances
ri_offerings = fetch_ri_offerings(instance_type, engine, region, multi_az)
ri_1yr = best_ri(ri_offerings, 1)
ri_3yr = best_ri(ri_offerings, 3)
ri_1yr_monthly = ri_1yr.effective_hourly * HOURS_PER_MONTH * num_instances if ri_1yr else None
ri_3yr_monthly = ri_3yr.effective_hourly * HOURS_PER_MONTH * num_instances if ri_3yr else None
dsp_entry_1yr = best_dsp(dsp_rates.get(instance_type, []), 1)
dsp_entry_3yr = best_dsp(dsp_rates.get(instance_type, []), 3)
# Multi-AZ consumes 2x the compute hours the savings plan must cover, mirroring
# the on-demand and RI Multi-AZ handling above. Without this, DSP savings are overstated.
az_multiplier = MULTI_AZ_MULTIPLIER if multi_az else 1.0
dsp_1yr_monthly = (
dsp_entry_1yr.rate_per_hour * HOURS_PER_MONTH * num_instances * az_multiplier
if dsp_entry_1yr
else None
)
dsp_3yr_monthly = (
dsp_entry_3yr.rate_per_hour * HOURS_PER_MONTH * num_instances * az_multiplier
if dsp_entry_3yr
else None
)
dsp_eligible = family in _DSP_ELIGIBLE_FAMILIES
notes = []
if od_hourly == 0:
notes.append(
f"No static on-demand price is bundled for {instance_type}, so the offline "
f"baseline is $0 and savings cannot be computed. Run against a live instance "
f"(no 'offline' subcommand) or supply pricing to get accurate figures."
)
if not dsp_eligible:
notes.append(
f"Database Savings Plans do not cover the {family} family. "
f"Eligible families: {', '.join(sorted(_DSP_ELIGIBLE_FAMILIES))}."
)
if multi_az:
notes.append(
"Multi-AZ pricing applied. Multi-AZ RIs are separate offerings from Single-AZ. "
"Ensure you purchase the correct deployment type."
)
if region != "us-east-1" and od_hourly > 0:
notes.append(
f"On-demand baseline for {instance_type} uses us-east-1 static pricing; "
f"actual {region} pricing may differ by 10-20%, so savings percentages are approximate. "
f"Provide live pricing or run in us-east-1 for exact figures."
)
def _fmt(ri, monthly, od):
if ri is None or monthly is None:
return None
savings = od - monthly
pct = (savings / od * 100) if od > 0 else 0
return {
"term_years": ri.term_years,
"payment_option": ri.payment_option,
"effective_hourly_per_instance": round(ri.effective_hourly, 4),
"upfront_total": round(ri.upfront_cost * num_instances, 2),
"monthly": round(monthly, 2),
"savings_monthly": round(savings, 2),
"savings_pct": round(pct, 1),
}
def _fmt_dsp(dsp, monthly, od):
if dsp is None or monthly is None:
return None
savings = od - monthly
pct = (savings / od * 100) if od > 0 else 0
return {
"term_years": dsp.term_years,
"payment_option": dsp.payment_option,
"rate_per_hour": round(dsp.rate_per_hour, 4),
"monthly": round(monthly, 2),
"savings_monthly": round(savings, 2),
"savings_pct": round(pct, 1),
}
options = []
if ri_1yr_monthly is not None:
options.append(("1yr RI", ri_1yr_monthly))
if ri_3yr_monthly is not None:
options.append(("3yr RI", ri_3yr_monthly))
if dsp_1yr_monthly is not None:
options.append(("1yr DSP", dsp_1yr_monthly))
if dsp_3yr_monthly is not None:
options.append(("3yr DSP", dsp_3yr_monthly))
if options:
best_label, best_cost = min(options, key=lambda x: x[1])
savings = od_monthly - best_cost
pct = (savings / od_monthly * 100) if od_monthly > 0 else 0
recommendation = {
"best_option": best_label,
"best_monthly_cost": round(best_cost, 2),
"savings_vs_on_demand": round(savings, 2),
"savings_pct": round(pct, 1),
}
else:
recommendation = {"best_option": "on_demand", "reason": "No RI or DSP offerings found."}
return {
"engine": engine,
"instance_type": instance_type,
"num_instances": num_instances,
"multi_az": multi_az,
"on_demand": {"hourly": round(od_hourly, 4), "monthly": round(od_monthly, 2)},
"ri_1yr": _fmt(ri_1yr, ri_1yr_monthly, od_monthly),
"ri_3yr": _fmt(ri_3yr, ri_3yr_monthly, od_monthly),
"dsp_1yr": _fmt_dsp(dsp_entry_1yr, dsp_1yr_monthly, od_monthly),
"dsp_3yr": _fmt_dsp(dsp_entry_3yr, dsp_3yr_monthly, od_monthly),
"recommendation": recommendation,
"notes": notes,
}
def analyze_instance_live(instance_id: str, region: str) -> dict:
import boto3
rds = boto3.client("rds", region_name=region)
try:
resp = rds.describe_db_instances(DBInstanceIdentifier=instance_id)
except Exception as e:
return {"instance_id": instance_id, "error": str(e)}
instances = resp.get("DBInstances", [])
if not instances:
return {"instance_id": instance_id, "error": "instance not found"}
inst = instances[0]
engine = inst.get("Engine", "")
instance_type = inst.get("DBInstanceClass", "")
multi_az = inst.get("MultiAZ", False)
replicas = inst.get("ReadReplicaDBInstanceIdentifiers", [])
result = build_comparison(
instance_type=instance_type,
engine=engine,
num_instances=1,
region=region,
multi_az=multi_az,
)
result["instance_id"] = instance_id
result["engine_version"] = inst.get("EngineVersion", "")
if replicas:
result["notes"].append(
f"Instance has {len(replicas)} read replica(s). "
"Consider separate RI/DSP for each replica (Single-AZ pricing)."
)
return result
def main():
parser = argparse.ArgumentParser(
description="RDS RI & Database Savings Plan estimator (read-only)"
)
parser.add_argument("--region", default="us-east-1")
parser.add_argument("--format", choices=["json"], default="json")
parser.add_argument("--instance", help="Analyze a single RDS instance by identifier")
sub = parser.add_subparsers(dest="mode")
off = sub.add_parser("offline", help="Use user-supplied workload description")
off.add_argument("--instance-type", required=True, help="e.g., db.r7g.2xlarge")
off.add_argument("--engine", required=True, choices=["mysql", "mariadb", "postgres"])
off.add_argument("--num-instances", type=int, default=1)
off.add_argument("--multi-az", action="store_true")
# --region and --format are defined on the main parser above; do NOT redefine them
# here, or the subparser's default silently overrides a value passed before 'offline'.
args = parser.parse_args()
if args.mode == "offline":
result = build_comparison(
instance_type=args.instance_type,
engine=args.engine,
num_instances=args.num_instances,
region=args.region,
multi_az=args.multi_az,
)
print(json.dumps(result, indent=2, default=str))
return
if args.instance:
result = analyze_instance_live(args.instance, args.region)
print(json.dumps(result, indent=2, default=str))
return
parser.print_help()
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 a command-line tool, 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/rds-oss · 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.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download rds-oss.zip