You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 24c3970
Browse filesBrowse the repository at this point in the historyBrowse files
fix(billing-cost-management-mcp-server): list ri-performance coverage group-by keys per service (#4833)
The ri-performance description listed one flat set of GetReservationCoverage
group_by keys, copied from the API reference and botocore. The service checks
the keys per service (from the SERVICE filter, EC2 by default), so the flat
list was wrong in both directions:
- INVOICING_ENTITY and OPERATING_SYSTEM are rejected for every service.
- INSTANCE_TYPE_FAMILY is valid for EC2 but was missing.
- CACHE_ENGINE, DATABASE_ENGINE and DEPLOYMENT_OPTION only work with their
own service's filter; with the EC2 default they return a ValidationException.
Also corrected:
- A UUID or ARN SubscriptionId filter returns a ValidationException ("must
contain only digits"), not an empty match.
- The utilization SERVICE filter accepts several values; only coverage caps
it, at 2.
- Added MemoryDB, OpenSearch and Elasticsearch to the coverage service list.
Every claim was checked against live GetReservationCoverage and
GetReservationUtilization calls, whose errors list the accepted keys per
service, e.g. "Only AZ, INSTANCE_TYPE, INSTANCE_TYPE_FAMILY, LINKED_ACCOUNT,
PLATFORM, REGION, TENANCY is supported for groupBy with type DIMENSION for
Amazon Elastic Compute Cloud - Compute".
Tests: a contract test pins the documented per-service keys, plus tests for
the invalid keys and the SubscriptionId format. Fixtures no longer group
coverage by SERVICE or use "Amazon EC2" as a SERVICE value.
Copy file name to clipboardExpand all lines: src/billing-cost-management-mcp-server/awslabs/billing_cost_management_mcp_server/tools/ri_performance_tools.py
+17-17Lines changed: 17 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -56,38 +56,38 @@
56
56
- Helps identify RIs that could be modified or sold in the marketplace
57
57
58
58
GROUPING get_reservation_coverage (group_by):
59
-
GetReservationCoverage groups ONLY by these attributes:
59
+
GetReservationCoverage groups ONLY by these attributes. Keys marked "only" apply just to
60
+
that service (from the SERVICE filter, EC2 when omitted); others return a ValidationException:
"Amazon MemoryDB", "Amazon Redshift", "Amazon OpenSearch Service", and
79
+
"Amazon Elasticsearch Service". Use the full Cost Explorer service display name, not
79
80
"EC2"/"RDS".
80
81
81
82
GROUPING get_reservation_utilization (group_by):
82
83
GetReservationUtilization groups ONLY by SUBSCRIPTION_ID. No other attribute is
83
84
valid. The SubscriptionId it returns (and that you filter on) is a NUMERIC id
84
85
(e.g. "359809062"), not an ARN, instance id, or UUID — filtering SubscriptionId
85
-
with an ARN/UUID returns no match.
86
+
with an ARN/UUID returns a ValidationException ("must contain only digits").
86
87
87
88
FILTERING (both operations): the Cost Explorer Expression supports only AND among
88
89
dimensions and nests one level deep; multiple values for one dimension are OR'd.
89
-
The SERVICE filter takes a single value and defaults to Amazon Elastic Compute
90
-
Cloud - Compute when omitted.
90
+
The SERVICE filter defaults to Amazon Elastic Compute Cloud - Compute when omitted.
91
91
92
92
SCOPING LARGE QUERIES: a grouped or DAILY query over a wide window or many
93
93
subscriptions can exceed the tool result size cap and return a ToolResultOversized
@@ -138,8 +138,8 @@ async def ri_performance(
138
138
end_date: End date in YYYY-MM-DD format (exclusive). Defaults to today if not provided.
139
139
granularity: Time granularity of the data (DAILY or MONTHLY). Defaults to DAILY. Ignored when group_by is provided (granularity and group_by are mutually exclusive).
140
140
metrics: List of metrics to retrieve for coverage as a JSON string (e.g., '["HoursCoverage", "CostCoverage"]'). Defaults to all metrics.
141
-
group_by: Optional grouping as a JSON string. For coverage: AZ, CACHE_ENGINE, DATABASE_ENGINE, DEPLOYMENT_OPTION, INSTANCE_TYPE, INVOICING_ENTITY, LINKED_ACCOUNT, OPERATING_SYSTEM, PLATFORM, REGION, or TENANCY (SERVICE is NOT valid — filter on it instead). For utilization: SUBSCRIPTION_ID only.
142
-
filter: Optional filter as a JSON string (e.g., by service, region, or instance type). SERVICE takes a single value and defaults to EC2 when omitted; valid coverage SERVICE values are "Amazon Elastic Compute Cloud - Compute", "Amazon Relational Database Service", "Amazon ElastiCache", and "Amazon Redshift" (use the full display name, not "EC2"/"RDS"). SubscriptionId values are numeric, not ARNs/UUIDs. A wide grouped/DAILY query may exceed the result size cap (ToolResultOversized) — scope it with a filter, a shorter window, or MONTHLY granularity.
141
+
group_by: Optional grouping as a JSON string. For coverage: AZ, CACHE_ENGINE, DATABASE_ENGINE, DEPLOYMENT_OPTION, INSTANCE_TYPE, INSTANCE_TYPE_FAMILY, LINKED_ACCOUNT, PLATFORM, REGION, or TENANCY, depending on the service (see the tool description) (SERVICE is NOT valid — filter on it instead). For utilization: SUBSCRIPTION_ID only.
142
+
filter: Optional filter as a JSON string (e.g., by service, region, or instance type). SERVICE defaults to EC2 when omitted; valid coverage SERVICE values are "Amazon Elastic Compute Cloud - Compute", "Amazon Relational Database Service", "Amazon ElastiCache", "Amazon MemoryDB", "Amazon Redshift", "Amazon OpenSearch Service", and "Amazon Elasticsearch Service" (use the full display name, not "EC2"/"RDS"). SubscriptionId values are numeric, not ARNs/UUIDs. A wide grouped/DAILY query may exceed the result size cap (ToolResultOversized) — scope it with a filter, a shorter window, or MONTHLY granularity.
143
143
sort_by: Optional sorting configuration as a JSON string with key and direction (ASCENDING or DESCENDING).
144
144
max_items: Total number of groups to return across all pages. Omit it to fetch every
145
145
page. Applies only to get_reservation_coverage with group_by set.
0 commit comments