If you're using Amazon RDS and want to identify charges related to Extended Support, you can analyze your AWS Cost and Usage Report (CUR) using Amazon Athena. RDS Extended Support applies when you're running database engine versions that have entered the extended support phase, such as MySQL 5.7 or PostgreSQL 11.
This article provides an Athena SQL query that returns RDS Extended Support costs by resource and usage hour.
Authored by Abdul Majid Mohammed, Vinod Jayendra
Prerequisites
Before running the query:
- Ensure you’ve enabled the AWS Cost and Usage Report (CUR) with resource IDs and hourly granularity.
- Confirm that your CUR data is stored in Amazon S3 and properly cataloged in AWS Glue or manually configured in Athena.
- Replace <cur_data_table_name> in below query with your actual database and table name.
Athena SQL Query
To retrieve Extended Support usage and cost for a specific day (e.g., 2025-05-27), use the following query:
WITH params AS (
SELECT
TIMESTAMP '2025-05-01 00:00:00' AS start_date,
TIMESTAMP '2025-06-01 00:00:00' AS end_date
)
SELECT
line_item_usage_account_id AS account_id,
product_region AS region,
line_item_resource_id AS rds_instance_id,
product_database_engine AS engine,
product_database_edition AS edition,
product_database_engine_type AS db_version,
line_item_usage_type AS usage_type,
SUM(line_item_unblended_cost) AS extended_support_cost_usd,
SUM(line_item_usage_amount) AS vcpu_hours
FROM
<cur_data_table_name>,
params
WHERE
line_item_product_code = 'AmazonRDS'
AND line_item_usage_type LIKE '%ExtendedSupport%'
AND line_item_line_item_type = 'Usage'
AND line_item_usage_start_date >= params.start_date
AND line_item_usage_start_date < params.end_date
GROUP BY
line_item_usage_account_id,
product_region,
line_item_resource_id,
product_database_engine,
product_database_edition,
product_database_engine_type,
line_item_usage_type
ORDER BY
extended_support_cost_usd DESC;
Explanation
- line_item_usage_type: Filters for usage types that include ExtendedSupport.
- line_item_unblended_cost: Returns the cost in USD.
- line_item_usage_start_date: Filters usage that started on the target date (in this case, May 27, 2025).
- SUM: Aggregates hourly charges into daily totals.
Additional Recommendations:
- Use Cost Explorer or AWS Budgets to monitor trends or alert on cost increases.
- Consider upgrading RDS database versions proactively to avoid Extended Support charges.
- Tag RDS resources consistently to allow further cost attribution using Athena queries.
- If you have further questions about analyzing CUR data or optimizing your RDS spend, reach out to AWS Support.