get_cost_and_usage_comparisons
¶
get_cost_and_usage_comparisons(
baseline_time_period: DateInterval,
comparison_time_period: DateInterval,
metric_for_comparison: MetricName,
*,
config_overrides: Optional[CostExplorerClientConfig] = None,
billing_view_arn: Optional[BillingViewArn] = None,
filter: Optional[Expression] = None,
group_by: Optional[GroupDefinitions] = None,
max_results: Optional[CostAndUsageComparisonsMaxResults] = None,
next_page_token: Optional[NextPageToken] = None,
) -> GetCostAndUsageComparisonsResponse
Retrieves cost and usage comparisons for your account between two periods within the last 13 months. If you have enabled multi-year data at monthly granularity, you can go back up to 38 months.
Parameters:
-
billing_view_arn(Optional[BillingViewArn], default:None) –The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.
-
baseline_time_period(DateInterval) –The reference time period for comparison. This time period serves as the baseline against which other cost and usage data will be compared. The interval must start and end on the first day of a month, with a duration of exactly one month.
-
comparison_time_period(DateInterval) –The comparison time period for analysis. This time period's cost and usage data will be compared against the baseline time period. The interval must start and end on the first day of a month, with a duration of exactly one month.
-
metric_for_comparison(MetricName) –The cost and usage metric to compare. Valid values are
AmortizedCost,BlendedCost,NetAmortizedCost,NetUnblendedCost,NormalizedUsageAmount,UnblendedCost, andUsageQuantity. -
group_by(Optional[GroupDefinitions], default:None) –You can group results using the attributes
DIMENSION,TAG, andCOST_CATEGORY. -
max_results(Optional[CostAndUsageComparisonsMaxResults], default:None) –The maximum number of results that are returned for the request.
-
next_page_token(Optional[NextPageToken], default:None) –The token to retrieve the next set of paginated results.
Raises:
-
BillingViewHealthStatusException–The billing view status must be
HEALTHYto perform this action. Try again when the status isHEALTHY. -
DataUnavailableException–The requested data is unavailable.
-
InvalidNextTokenException–The pagination token is invalid. Try again without a pagination token.
-
LimitExceededException–You made too many calls in a short period of time. Try again later.
-
ResourceNotFoundException–The specified ARN in the request doesn't exist.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cost_explorer/_services/cost_explorer.py
1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 | |