Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to view and modify the configuration of your machine
type recommendations. You can modify which machine types are recommended,
so the generated recommendations only include your preferred machine series.
You can also change the metrics used to generate memory recommendations to
improve the accuracy of the recommendations. The changes to the configuration
are applied at the project level.
If you haven't already, set up authentication.
Authentication verifies your identity for access to Google Cloud services and APIs. To run
code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Install the Google Cloud CLI.
After installation,
initialize the Google Cloud CLI by running the following command:
This predefined role contains
the permissions required to modify machine type recommendations. To see the exact permissions that are
required, expand the Required permissions section:
Required permissions
The following permissions are required to modify machine type recommendations:
View the machine type recommendation configuration:
recommender.computeInstanceMachineTypeRecommenderConfig.get
on the project
Modify the machine type recommendation configuration:
recommender.computeInstanceMachineTypeRecommenderConfig.update
on the project
The configuration lets you customize the following parameters:
preferred_machine_types: The machine types recommendations that you receive.
memory_metrics: How memory metrics are used to generate recommendations.
Options for machine types recommendations
You can specify which machine types recommendations you get by changing
the preferred_machine_types setting to one of the following values:
DEFAULT: The default value is STANDARD_AND_CUSTOM.
STANDARD_AND_CUSTOM: Recommends the best match from standard and custom
machine types.
STANDARD_ONLY: Recommends the best match from standard machine types only.
Options for memory recommendations
For the memory metrics used to generate the recommendations, you can set
the following values:
MEMORY_METRICS_DEFAULT: Use the default metrics to generate recommendations.
MEMORY_METRICS_ALL: Use all the available metrics to generate
recommendations.
MONITORING_AGENT_ONLY: Use only metrics collected by the
Cloud Monitoring Ops Agent.
If you don't use the Ops Agent, and prefer not to receive memory
recommendations, use the MEMORY_AGENT_ONLY value to disable
the recommendations.
To get more accurate recommendations about memory usage, use the
Ops Agent.
Update the configuration for a project
To update the configuration of your machine type recommendations, modify the
configuration values and upload the new configuration for your project.
You can change the preferred machine types, the memory metrics used for
recommendations, or both values in the same request.
After you upload the new configuration, it takes approximately 48 hours for it
to take effect. Until that time, any generated recommendations use the previous
configuration.
ZONE: the zone for which you want to obtain the
current configuration.
LOCAL_FILE_PATH_AND_NAME: the path to the JSON file
with the current configuration.
ETAG: the etag value of the current configuration.
You can find this value in the output of the
previous command.
In your configuration file, specify only the recommenderGenerationConfig
object with the updated configuration parameters. If you saved the
configuration to a local file, make sure you copy the etag value, then
remove all the fields except the recommenderGenerationConfig value.
For example, to get recommendations with standard machine types only,
use the following configuration file:
If the command is successful, it returns a response body similar to the
following, showing the new configuration with the parameters you just
modified.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 UTC."],[[["\u003cp\u003eThis page guides users on how to customize machine type recommendations at the project level, allowing them to control which machine series are suggested and how memory metrics are used in generating these recommendations.\u003c/p\u003e\n"],["\u003cp\u003eTo modify machine type recommendations, users need the "Compute Recommender Admin" IAM role, which grants the necessary permissions to view and update the recommendation configuration.\u003c/p\u003e\n"],["\u003cp\u003eThe configuration of machine type recommendations involves three main steps: retrieving the current configuration in JSON format, editing this configuration to specify preferred machine types and memory metrics, and uploading the updated file.\u003c/p\u003e\n"],["\u003cp\u003eUsers can specify their preferences for machine type recommendations, choosing between standard and custom types, or standard types only, and can also define how memory metrics are utilized, even opting to rely solely on the Cloud Monitoring Ops Agent or disabling memory recommendations.\u003c/p\u003e\n"],["\u003cp\u003eAfter uploading a new configuration, it takes approximately 48 hours for the changes to take effect, and during this time, the system will continue to use the previous settings for generating any recommendations.\u003c/p\u003e\n"]]],[],null,["*** ** * ** ***\n\n|\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis page describes how to view and modify the configuration of your machine\ntype recommendations. You can modify which machine types are recommended,\nso the generated recommendations only include your preferred machine series.\nYou can also change the metrics used to generate memory recommendations to\nimprove the accuracy of the recommendations. The changes to the configuration\nare applied at the project level.\n\nFor more information about machine type recommendations, see\n[Apply machine type recommendations for VMs](/compute/docs/instances/apply-machine-type-recommendations-for-instances).\n\nBefore you begin\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\nRequired roles\n\n\nTo get the permissions that\nyou need to modify machine type recommendations,\n\nask your administrator to grant you the\n\n\n[Compute Recommender Admin](/iam/docs/roles-permissions/recommender#recommender.computeAdmin) (`roles/recommender.computeAdmin`)\nIAM role on your project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains\n\nthe permissions required to modify machine type recommendations. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\nRequired permissions\n\nThe following permissions are required to modify machine type recommendations:\n\n- View the machine type recommendation configuration: `recommender.computeInstanceMachineTypeRecommenderConfig.get` on the project\n- Modify the machine type recommendation configuration: `recommender.computeInstanceMachineTypeRecommenderConfig.update` on the project\n\n\nYou might also be able to get\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nConfigure your recommendations\n\nTo configure your machine type recommendations, perform the following steps:\n\n1. [Get the current configuration](#get_current_configuration) to obtain the JSON file of the configuration.\n2. Edit the configuration file in JSON format.\n3. [Upload the new configuration file](#update_configuration) to apply the changes.\n\nGet the current configuration\n\nYou can obtain the current configuration for machine type recommendations for\nyour project by using the Google Cloud CLI. \n\ngcloud\n\nTo get the current configuration parameters, use the\n[`gcloud beta recommender recommender-config describe` command](/sdk/gcloud/reference/beta/recommender/recommender-config/describe)\nand use `google.compute.instance.MachineTypeRecommender` as the\nRecommender ID: \n\n```\ngcloud beta recommender recommender-config describe google.compute.instance.MachineTypeRecommender \\\n --project=PROJECT_ID \\\n --location=ZONE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your project.\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone for which you want to obtain the current configuration.\n\nThe command returns the recommender configuration, including the modifiable\nsubfields `preferred_machine_types` and `memory_metrics`. \n\n```\n{\n \"name\": \"projects/PROJECT_ID/locations/ZONE/recommenders/google.compute.instance.MachineTypeRecommender/config\",\n \"recommenderGenerationConfig\": {\n \"params\": {\n \"preferred_machine_types\": \"STANDARD_AND_CUSTOM\",\n \"memory_metrics\": \"MONITORING_AGENT_ONLY\"\n }\n },\n \"etag\": \"\\\"2f3c9b65cda6a4ba\\\"\",\n \"updateTime\": \"2024-08-20T04:41:15.330351Z\"\n}\n```\n\nIf you want to save the configuration to a local file, so you can edit it\nand upload it later, run the following command: \n\n```\ngcloud beta recommender recommender-config describe \\\n google.compute.instance.MachineTypeRecommender \\\n --project=PROJECT_ID \\\n --location=ZONE \u003e LOCAL_FILE_PATH_AND_NAME\n```\n\nEdit the recommendation configuration\n\nThe configuration lets you customize the following parameters:\n\n- `preferred_machine_types`: The machine types recommendations that you receive.\n- `memory_metrics`: How memory metrics are used to generate recommendations.\n\nOptions for machine types recommendations\n\nYou can specify which machine types recommendations you get by changing\nthe `preferred_machine_types` setting to one of the following values:\n\n- `DEFAULT`: The default value is `STANDARD_AND_CUSTOM`.\n- `STANDARD_AND_CUSTOM`: Recommends the best match from standard and custom machine types.\n- `STANDARD_ONLY`: Recommends the best match from standard machine types only.\n\nOptions for memory recommendations\n\nFor the memory metrics used to generate the recommendations, you can set\nthe following values:\n\n- `MEMORY_METRICS_DEFAULT`: Use the default metrics to generate recommendations.\n- `MEMORY_METRICS_ALL`: Use all the available metrics to generate recommendations.\n- `MONITORING_AGENT_ONLY`: Use only metrics collected by the Cloud Monitoring Ops Agent.\n- If you don't use the Ops Agent, and prefer not to receive memory recommendations, use the `MEMORY_AGENT_ONLY` value to disable the recommendations.\n\nTo get more accurate recommendations about memory usage, use the\n[Ops Agent](/monitoring/agent/ops-agent).\n\nUpdate the configuration for a project\n\nTo update the configuration of your machine type recommendations, modify the\nconfiguration values and upload the new configuration for your project.\nYou can change the preferred machine types, the memory metrics used for\nrecommendations, or both values in the same request.\n\nAfter you upload the new configuration, it takes approximately 48 hours for it\nto take effect. Until that time, any generated recommendations use the previous\nconfiguration. \n\ngcloud\n\nTo update the configuration parameters, use the\n[`gcloud beta recommender recommender-config update` command](/sdk/gcloud/reference/beta/recommender/recommender-config/update)\nand use `google.compute.instance.MachineTypeRecommender` as the\nRecommender ID: \n\n```\ngcloud beta recommender recommender-config update google.compute.instance.MachineTypeRecommender\\\n --project=PROJECT_ID \\\n --location=ZONE \\\n --config-file=LOCAL_FILE_PATH_AND_NAME \\\n --etag=ETAG\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your project.\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone for which you want to obtain the current configuration.\n- \u003cvar translate=\"no\"\u003eLOCAL_FILE_PATH_AND_NAME\u003c/var\u003e: the path to the JSON file with the current configuration.\n- \u003cvar translate=\"no\"\u003eETAG\u003c/var\u003e: the etag value of the current configuration. You can find this value in the output of the [previous command](#get_current_configuration).\n\nIn your configuration file, specify only the `recommenderGenerationConfig`\nobject with the updated configuration parameters. If you saved the\nconfiguration to a local file, make sure you copy the `etag` value, then\nremove all the fields except the `recommenderGenerationConfig` value.\n\nFor example, to get recommendations with standard machine types only,\nuse the following configuration file: \n\n```\n{\n \"params\": {\n \"preferred_machine_types\": \"STANDARD_ONLY\"\n }\n}\n```\n\nIf the command is successful, it returns a response body similar to the\nfollowing, showing the new configuration with the parameters you just\nmodified. \n\n```\n{\n \"name\": \"projects/PROJECT_ID/locations/ZONE/recommenders/google.compute.instance.MachineTypeRecommender/config\",\n \"recommenderGenerationConfig\": {\n \"params\": {\n \"preferred_machine_types\": \"STANDARD_ONLY\"\n }\n },\n \"etag\": \"\\\"1245f9435cd01ea8\\\"\",\n \"updateTime\": \"2024-08-20T05:00:05Z\"\n}\n```\n| **Note:** the `etag` value changes from the previous configuration. You must use the new value if you update the configuration again.\n\nWhat's next\n\n- Learn how to [Apply machine type recommendations to instances](/compute/docs/instances/apply-machine-type-recommendations-for-instances).\n- Learn how to [Apply machine type recommendations to managed instance groups](/compute/docs/instance-groups/apply-machine-type-recommendations-managed-instance-groups)."]]