Organizations migrating from ElastiCache for Redis to Valkey often struggle to track costs per engine in Cost Explorer. While there is no dedicated "Database Engine" dimension, the Usage Type filter distinguishes them (CreateCacheCluster:0002 for Redis, CreateCacheCluster:Valkey for Valkey). For deeper analysis across accounts, you can query the CUR product_cache_engine field with Athena.
Overview
Organizations running both ElastiCache for Redis and ElastiCache for Valkey often need to track costs per engine, for migration ROI, chargeback, or billing validation. The CUR product_cache_engine field provides exactly this visibility. This guide shows how to query it with Athena to get a per-engine cost breakdown across accounts.
Prerequisites
- AWS Cost and Usage Report enabled and configured
- CUR data integrated with Amazon Athena
- Appropriate IAM permissions for Athena queries
The Athena Query
Query to list all ElastiCache Redis and Valkey clusters from CUR
SELECT DISTINCT
line_item_usage_account_id as account_id,
SPLIT_PART(line_item_resource_id, ':', 7) as cluster_id,
product_cache_engine as cache_engine,
SPLIT_PART(line_item_usage_type, ':', 2) as instance_type,
product_location as region
FROM "your_cur_table_name" -- Replace with your actual CUR table name
WHERE line_item_product_code = 'AmazonElastiCache'
AND product_cache_engine IN ('Redis', 'Valkey')
AND line_item_line_item_type IN ('DiscountedUsage', 'Usage')
ORDER BY cache_engine, account_id, cluster_id;
Query Explanation
- line_item_usage_account_id: Identifies the AWS account running the cluster
- SPLIT_PART(line_item_resource_id, ':', 7): Extracts cluster ID from the resource ARN
- product_cache_engine IN ('Redis', 'Valkey'): Filters for specific cache engines
What the Results Include
Account ID, Cluster ID, Cache engine (Redis or Valkey), Instance type/size, AWS Region
Alternative: Cost Explorer API Operation Filter
While Cost Explorer doesn't expose a dedicated "Database Engine" dimension, you can use the API Operation (Usage Type) filter/group-by to differentiate between Redis and Valkey usage:
CreateCacheCluster:0002 → Redis usage
CreateCacheCluster:Valkey → Valkey usage
This is available in the Cost Explorer console under Group by → Usage Type or via the Cost Explorer API using the USAGE_TYPE dimension. This approach doesn't require CUR access or Athena queries, making it accessible to FinOps stakeholders without SQL expertise.