getRightsizingRecommendation method
- required String service,
- RightsizingRecommendationConfiguration? configuration,
- Expression? filter,
- String? nextPageToken,
- int? pageSize,
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 details on calculation and function, see Optimizing Your Cost with Rightsizing Recommendations in the AWS Billing and Cost Management User Guide.
May throw LimitExceededException. May throw InvalidNextTokenException.
Parameter service
:
The specific service that you want recommendations for. The only valid
value for GetRightsizingRecommendation
is
"AmazonEC2
".
Parameter configuration
:
Enables you 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 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 {
ArgumentError.checkNotNull(service, 'service');
_s.validateStringLength(
'service',
service,
0,
1024,
isRequired: true,
);
_s.validateStringLength(
'nextPageToken',
nextPageToken,
0,
8192,
);
_s.validateNumRange(
'pageSize',
pageSize,
0,
1152921504606846976,
);
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);
}