AWS GetEC2InstanceRecommendations

0

Hi AWS, I am trying to run the CLI command to check if the following EC2 instance is overprovisioned, underprovisioned or optimized. The command is:

aws compute-optimizer get-ec2-instance-recommendations --instance-arns <instance-arn> --account-ids <aws-account-id> --region <aws-region>

And I am getting this error: An error occurred (OptInRequiredException) when calling the GetEC2InstanceRecommendations operation: Aws account is not registered for recommendation.

Do I need to do any external setup in order to get rid of this error. Please help.

profile picture
Arjun
asked 8 months ago365 views
3 Answers
0

The error message "Aws account is not registered for recommendation" indicates that your AWS account is not opted in for Compute Optimizer. AWS Compute Optimizer provides recommendations for optimizing your EC2 instances, but it requires you to enable the service for your account before you can use it.

To resolve this issue and start using Compute Optimizer, you need to enable the service for your AWS account. Here's how you can do that:

** Enable Compute Optimizer via AWS Management Console:**

  • Log in to the AWS Management Console.
  • Navigate to the Compute Optimizer service page.
  • If this is the first time you're accessing Compute Optimizer, you will likely see an option to "Get started."
  • Follow the on-screen instructions to enable Compute Optimizer for your AWS account.

Enable Compute Optimizer via AWS CLI: You can also use the AWS CLI to enable Compute Optimizer for your account:

aws compute-optimizer update-enrollment-status --status ACTIVE

This command will activate Compute Optimizer for your AWS account.

After you have enabled Compute Optimizer for your account, you should be able to use the get-ec2-instance-recommendations command without encountering the "OptInRequiredException" error.

Keep in mind that it might take some time for Compute Optimizer to gather enough data to provide meaningful recommendations. Once the service has sufficient data, you'll be able to retrieve recommendations for your EC2 instances.

answered 8 months ago
  • The command I provided above will help me with the Findings of the Instance (Overprovisioned, Underprovisioned and Optimized) along with the recommendations, right @Sahith Palika

  • Yes, you are absolutely right.

0

Hi, you have to opt-in as per step02 of https://aws.amazon.com/compute-optimizer/getting-started/ to be able to run the command that you mention.

Best,

Didier

profile pictureAWS
EXPERT
answered 8 months ago
  • Now, when I am running the CLI command I am getting this output:

    { "instanceRecommendations": [], "errors": [] }

    Is it because of the fact that Compute Optimizer takes up to 12 hours to generate the data as per the AWS documentation though the instances are older than 30 hours. I have attached the documentation screenshot. Any suggestions why it is happening?

  • How to find findings status for the instance type for which the feature is not supported. For e.g. when I am running the command for one of the instance I am getting this message:

    { "instanceRecommendations": [], "errors": [ { "identifier": "arn:aws:ec2:*:xxxxxxxxxxxx:instance/i-xxxxxxxxxxxxxxxxx", "code": "UNSUPPORTED_CONFIGURATION", "message": "Unsupported instance with type r6a.2xlarge" } ] }

0

Enter image description here

profile picture
Arjun
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions