Skip to content

get_auto_scaling_group_recommendations

get_auto_scaling_group_recommendations(
    *,
    config_overrides: Optional[ComputeOptimizerClientConfig] = None,
    account_ids: Optional[AccountIds] = None,
    auto_scaling_group_arns: Optional[AutoScalingGroupArns] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
    filters: Optional[Filters] = None,
    recommendation_preferences: Optional[RecommendationPreferences] = None,
) -> GetAutoScalingGroupRecommendationsResponse

Returns Auto Scaling group recommendations.

Compute Optimizer generates recommendations for Amazon EC2 Auto Scaling groups that meet a specific set of requirements. For more information, see the Supported resources and requirements in the Compute Optimizer User Guide.

Parameters:

  • account_ids (Optional[AccountIds], default: None ) –

    The ID of the Amazon Web Services account for which to return Auto Scaling group recommendations.

    If your account is the management account of an organization, use this parameter to specify the member account for which you want to return Auto Scaling group recommendations.

    Only one account ID can be specified per request.

  • auto_scaling_group_arns (Optional[AutoScalingGroupArns], default: None ) –

    The Amazon Resource Name (ARN) of the Auto Scaling groups for which to return recommendations.

  • next_token (Optional[NextToken], default: None ) –

    The token to advance to the next page of Auto Scaling group recommendations.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of Auto Scaling group recommendations to return with a single request.

    To retrieve the remaining results, make another request with the returned nextToken value.

  • filters (Optional[Filters], default: None ) –

    An array of objects to specify a filter that returns a more specific list of Auto Scaling group recommendations.

  • recommendation_preferences (Optional[RecommendationPreferences], default: None ) –

    An object to specify the preferences for the Auto Scaling group recommendations to return in the response.

Raises:

Source code in docs_src/capo_compute_optimizer/_services/compute_optimizer.py
def get_auto_scaling_group_recommendations(
    self,
    *,
    config_overrides: Optional[ComputeOptimizerClientConfig] = None,
    account_ids: Optional[
        "capo_compute_optimizer.types.account_ids.AccountIds"
    ] = None,
    auto_scaling_group_arns: Optional[
        "capo_compute_optimizer.types.auto_scaling_group_arns.AutoScalingGroupArns"
    ] = None,
    next_token: Optional[
        "capo_compute_optimizer.types.next_token.NextToken"
    ] = None,
    max_results: Optional[
        "capo_compute_optimizer.types.max_results.MaxResults"
    ] = None,
    filters: Optional["capo_compute_optimizer.types.filters.Filters"] = None,
    recommendation_preferences: Optional[
        "capo_compute_optimizer.types.recommendation_preferences.RecommendationPreferences"
    ] = None,
) -> "capo_compute_optimizer.types.get_auto_scaling_group_recommendations_response.GetAutoScalingGroupRecommendationsResponse":
    """<p>Returns Auto Scaling group recommendations.</p> <p>Compute Optimizer generates recommendations for Amazon EC2 Auto Scaling groups that meet a specific set of requirements. For more information, see the <a href="https://docs.aws.amazon.com/compute-optimizer/latest/ug/requirements.html">Supported resources and requirements</a> in the <i>Compute Optimizer User Guide</i>.</p>

    Args:
        account_ids: <p>The ID of the Amazon Web Services account for which to return Auto Scaling group recommendations.</p> <p>If your account is the management account of an organization, use this parameter to specify the member account for which you want to return Auto Scaling group recommendations.</p> <p>Only one account ID can be specified per request.</p>
        auto_scaling_group_arns: <p>The Amazon Resource Name (ARN) of the Auto Scaling groups for which to return recommendations.</p>
        next_token: <p>The token to advance to the next page of Auto Scaling group recommendations.</p>
        max_results: <p>The maximum number of Auto Scaling group recommendations to return with a single request.</p> <p>To retrieve the remaining results, make another request with the returned <code>nextToken</code> value.</p>
        filters: <p>An array of objects to specify a filter that returns a more specific list of Auto Scaling group recommendations.</p>
        recommendation_preferences: <p>An object to specify the preferences for the Auto Scaling group recommendations to return in the response.</p>

    Raises:
        capo_compute_optimizer.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_compute_optimizer.errors.internal_server_exception.InternalServerException: <p>An internal error has occurred. Try your call again.</p>
        capo_compute_optimizer.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value supplied for the input parameter is out of range or not valid.</p>
        capo_compute_optimizer.errors.missing_authentication_token.MissingAuthenticationToken: <p>The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 certificate.</p>
        capo_compute_optimizer.errors.opt_in_required_exception.OptInRequiredException: <p>The account is not opted in to Compute Optimizer.</p>
        capo_compute_optimizer.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource that is required for the action doesn't exist.</p>
        capo_compute_optimizer.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request has failed due to a temporary failure of the server.</p>
        capo_compute_optimizer.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_compute_optimizer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_compute_optimizer.types.get_auto_scaling_group_recommendations_request.GetAutoScalingGroupRecommendationsRequest]",
    ) -> OperationResponse[
        "capo_compute_optimizer.types.get_auto_scaling_group_recommendations_response.GetAutoScalingGroupRecommendationsResponse"
    ]:
        import capo_compute_optimizer._operations.compute_optimizer_service.get_auto_scaling_group_recommendations

        output, http_response = (
            capo_compute_optimizer._operations.compute_optimizer_service.get_auto_scaling_group_recommendations.get_auto_scaling_group_recommendations(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetAutoScalingGroupRecommendations")
    )
    input_: capo_compute_optimizer.types.get_auto_scaling_group_recommendations_request.GetAutoScalingGroupRecommendationsRequest = {}
    if account_ids is not None:
        input_["account_ids"] = account_ids
    if auto_scaling_group_arns is not None:
        input_["auto_scaling_group_arns"] = auto_scaling_group_arns
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if filters is not None:
        input_["filters"] = filters
    if recommendation_preferences is not None:
        input_["recommendation_preferences"] = recommendation_preferences

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output