GetEffectiveRecommendationPreferencesCommand

Returns the recommendation preferences that are in effect for a given resource, such as enhanced infrastructure metrics. Considers all applicable preferences that you might have set at the resource, account, and organization level.

When you create a recommendation preference, you can set its status to Active or Inactive. Use this action to view the recommendation preferences that are in effect, or Active.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ComputeOptimizerClient, GetEffectiveRecommendationPreferencesCommand } from "@aws-sdk/client-compute-optimizer"; // ES Modules import
// const { ComputeOptimizerClient, GetEffectiveRecommendationPreferencesCommand } = require("@aws-sdk/client-compute-optimizer"); // CommonJS import
const client = new ComputeOptimizerClient(config);
const input = { // GetEffectiveRecommendationPreferencesRequest
  resourceArn: "STRING_VALUE", // required
};
const command = new GetEffectiveRecommendationPreferencesCommand(input);
const response = await client.send(command);
// { // GetEffectiveRecommendationPreferencesResponse
//   enhancedInfrastructureMetrics: "Active" || "Inactive",
//   externalMetricsPreference: { // ExternalMetricsPreference
//     source: "Datadog" || "Dynatrace" || "NewRelic" || "Instana",
//   },
//   lookBackPeriod: "DAYS_14" || "DAYS_32" || "DAYS_93",
//   utilizationPreferences: [ // UtilizationPreferences
//     { // UtilizationPreference
//       metricName: "CpuUtilization" || "MemoryUtilization",
//       metricParameters: { // CustomizableMetricParameters
//         threshold: "P90" || "P95" || "P99_5",
//         headroom: "PERCENT_30" || "PERCENT_20" || "PERCENT_10" || "PERCENT_0",
//       },
//     },
//   ],
//   preferredResources: [ // EffectivePreferredResources
//     { // EffectivePreferredResource
//       name: "Ec2InstanceTypes",
//       includeList: [ // PreferredResourceValues
//         "STRING_VALUE",
//       ],
//       effectiveIncludeList: [
//         "STRING_VALUE",
//       ],
//       excludeList: [
//         "STRING_VALUE",
//       ],
//     },
//   ],
// };

GetEffectiveRecommendationPreferencesCommand Input

Parameter
Type
Description
resourceArn
Required
string | undefined

The Amazon Resource Name (ARN) of the resource for which to confirm effective recommendation preferences. Only EC2 instance and Auto Scaling group ARNs are currently supported.

GetEffectiveRecommendationPreferencesCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
enhancedInfrastructureMetrics
EnhancedInfrastructureMetrics | undefined

The status of the enhanced infrastructure metrics recommendation preference. Considers all applicable preferences that you might have set at the resource, account, and organization level.

A status of Active confirms that the preference is applied in the latest recommendation refresh, and a status of Inactive confirms that it's not yet applied to recommendations.

To validate whether the preference is applied to your last generated set of recommendations, review the effectiveRecommendationPreferences value in the response of the GetAutoScalingGroupRecommendations and GetEC2InstanceRecommendations actions.

For more information, see Enhanced infrastructure metrics  in the Compute Optimizer User Guide.

externalMetricsPreference
ExternalMetricsPreference | undefined

The provider of the external metrics recommendation preference. Considers all applicable preferences that you might have set at the account and organization level.

If the preference is applied in the latest recommendation refresh, an object with a valid source value appears in the response. If the preference isn't applied to the recommendations already, then this object doesn't appear in the response.

To validate whether the preference is applied to your last generated set of recommendations, review the effectiveRecommendationPreferences value in the response of the GetEC2InstanceRecommendations actions.

For more information, see Enhanced infrastructure metrics  in the Compute Optimizer User Guide.

lookBackPeriod
LookBackPeriodPreference | undefined

The number of days the utilization metrics of the Amazon Web Services resource are analyzed.

To validate that the preference is applied to your last generated set of recommendations, review the effectiveRecommendationPreferences value in the response of the GetAutoScalingGroupRecommendations or GetEC2InstanceRecommendations actions.

preferredResources
EffectivePreferredResource[] | undefined

The resource type values that are considered as candidates when generating rightsizing recommendations. This object resolves any wildcard expressions and returns the effective list of candidate resource type values. It also considers all applicable preferences that you set at the resource, account, and organization level.

To validate that the preference is applied to your last generated set of recommendations, review the effectiveRecommendationPreferences value in the response of the GetAutoScalingGroupRecommendations or GetEC2InstanceRecommendations actions.

utilizationPreferences
UtilizationPreference[] | undefined

The resource’s CPU and memory utilization preferences, such as threshold and headroom, that were used to generate rightsizing recommendations. It considers all applicable preferences that you set at the resource, account, and organization level.

To validate that the preference is applied to your last generated set of recommendations, review the effectiveRecommendationPreferences value in the response of the GetAutoScalingGroupRecommendations or GetEC2InstanceRecommendations actions.

Throws

Name
Fault
Details
AccessDeniedException
client

You do not have sufficient access to perform this action.

InternalServerException
server

An internal error has occurred. Try your call again.

InvalidParameterValueException
client

The value supplied for the input parameter is out of range or not valid.

MissingAuthenticationToken
client

The request must contain either a valid (registered) Amazon Web Services access key ID or X.509 certificate.

OptInRequiredException
client

The account is not opted in to Compute Optimizer.

ResourceNotFoundException
client

A resource that is required for the action doesn't exist.

ServiceUnavailableException
server

The request has failed due to a temporary failure of the server.

ThrottlingException
client

The request was denied due to request throttling.

ComputeOptimizerServiceException
Base exception class for all service exceptions from ComputeOptimizer service.