getRightsizingRecommendation method
Creates recommendations that help you save cost by identifying idle and underutilized Amazon EC2 instances.
Recommendations are generated to either downsize or terminate instances, along with providing savings detail and metrics. For more information about calculation and function, see Optimizing Your Cost with Rightsizing Recommendations in the Billing and Cost Management User Guide.
May throw InvalidNextTokenException.
May throw LimitExceededException.
Parameter service :
The specific service that you want recommendations for. The only valid
value for GetRightsizingRecommendation is
"AmazonEC2".
Parameter configuration :
You can use Configuration to customize recommendations across two
attributes. You can choose to view recommendations for instances within
the same instance families or across different instance families. You can
also choose to view your estimated savings that are associated with
recommendations with consideration of existing Savings Plans or RI
benefits, or neither.
Parameter nextPageToken :
The pagination token that indicates the next set of results that you want
to retrieve.
Parameter pageSize :
The number of recommendations that you want returned in a single response
object.
Implementation
Future<GetRightsizingRecommendationResponse> getRightsizingRecommendation({
required String service,
RightsizingRecommendationConfiguration? configuration,
Expression? filter,
String? nextPageToken,
int? pageSize,
}) async {
_s.validateNumRange(
'pageSize',
pageSize,
0,
6000,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSInsightsIndexService.GetRightsizingRecommendation'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Service': service,
if (configuration != null) 'Configuration': configuration,
if (filter != null) 'Filter': filter,
if (nextPageToken != null) 'NextPageToken': nextPageToken,
if (pageSize != null) 'PageSize': pageSize,
},
);
return GetRightsizingRecommendationResponse.fromJson(jsonResponse.body);
}