public sealed class AutoscalingPolicy : IMessage<AutoscalingPolicy>, IEquatable<AutoscalingPolicy>, IDeepCloneable<AutoscalingPolicy>, IBufferMessage, IMessage
Reference documentation and code samples for the Compute Engine v1 API class AutoscalingPolicy.
The number of seconds that your application takes to initialize on a VM instance. This is referred to as the initialization period. Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process.
The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas.
The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed.
Defines the operating mode for this policy. The following modes are available: - OFF: Disables the autoscaler but maintains its configuration. - ONLY_SCALE_OUT: Restricts the autoscaler to add VM instances only. - ON: Enables all autoscaler activities according to its policy. For more information, see "Turning off or restricting an autoscaler"
Check the Mode enum for the list of possible values.
public MapField<string, AutoscalingPolicyScalingSchedule> ScalingSchedules { get; }
Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-08 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eAutoscalingPolicy\u003c/code\u003e class in the Google.Cloud.Compute.V1 API is 3.6.0, and there are several previous versions available, ranging from 3.5.0 down to 1.0.0.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eAutoscalingPolicy\u003c/code\u003e is a class used for defining policies for the Cloud Autoscaler, allowing scaling based on CPU utilization, custom metrics, and load balancer traffic.\u003c/p\u003e\n"],["\u003cp\u003eThis class includes properties for setting the cool-down period, maximum and minimum number of replicas, operating mode, and configurations for CPU utilization, custom metrics, and load balancing.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eAutoscalingPolicy\u003c/code\u003e class also supports defining scaling schedules and controlling how scaling in is handled, through the \u003ccode\u003eScaleInControl\u003c/code\u003e property, along with a maximum of 128 scaling schedules.\u003c/p\u003e\n"],["\u003cp\u003eThe namespace for the AutoscalingPolicy class is Google.Cloud.Compute.V1, and it is located within the Google.Cloud.Compute.V1.dll assembly.\u003c/p\u003e\n"]]],[],null,["# Compute Engine v1 API - Class AutoscalingPolicy (3.13.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.13.0 (latest)](/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.12.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.11.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.10.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.9.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.8.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.7.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.6.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.5.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.4.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.4.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.3.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.2.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.1.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/3.0.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.17.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.17.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.16.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.16.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.15.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.15.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.14.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.14.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.13.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.13.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.12.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.12.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.11.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.11.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.10.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.10.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.9.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.8.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.7.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.6.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.5.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.4.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.3.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.2.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.1.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/2.0.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/1.4.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/1.3.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/1.2.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/1.1.0/Google.Cloud.Compute.V1.AutoscalingPolicy)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Compute.V1/1.0.0/Google.Cloud.Compute.V1.AutoscalingPolicy) \n\n public sealed class AutoscalingPolicy : IMessage\u003cAutoscalingPolicy\u003e, IEquatable\u003cAutoscalingPolicy\u003e, IDeepCloneable\u003cAutoscalingPolicy\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Compute Engine v1 API class AutoscalingPolicy.\n\nCloud Autoscaler policy. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e AutoscalingPolicy \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[AutoscalingPolicy](/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AutoscalingPolicy), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[AutoscalingPolicy](/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AutoscalingPolicy), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[AutoscalingPolicy](/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1.AutoscalingPolicy), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Compute.V1](/dotnet/docs/reference/Google.Cloud.Compute.V1/latest/Google.Cloud.Compute.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Compute.V1.dll\n\nConstructors\n------------\n\n### AutoscalingPolicy()\n\n public AutoscalingPolicy()\n\n### AutoscalingPolicy(AutoscalingPolicy)\n\n public AutoscalingPolicy(AutoscalingPolicy other)\n\nProperties\n----------\n\n### CoolDownPeriodSec\n\n public int CoolDownPeriodSec { get; set; }\n\nThe number of seconds that your application takes to initialize on a VM instance. This is referred to as the [initialization period](/compute/docs/autoscaler#cool_down_period). Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process.\n\n### CpuUtilization\n\n public AutoscalingPolicyCpuUtilization CpuUtilization { get; set; }\n\nDefines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group.\n\n### CustomMetricUtilizations\n\n public RepeatedField\u003cAutoscalingPolicyCustomMetricUtilization\u003e CustomMetricUtilizations { get; }\n\nConfiguration parameters of autoscaling based on a custom metric.\n\n### HasCoolDownPeriodSec\n\n public bool HasCoolDownPeriodSec { get; }\n\nGets whether the \"cool_down_period_sec\" field is set\n\n### HasMaxNumReplicas\n\n public bool HasMaxNumReplicas { get; }\n\nGets whether the \"max_num_replicas\" field is set\n\n### HasMinNumReplicas\n\n public bool HasMinNumReplicas { get; }\n\nGets whether the \"min_num_replicas\" field is set\n\n### HasMode\n\n public bool HasMode { get; }\n\nGets whether the \"mode\" field is set\n\n### LoadBalancingUtilization\n\n public AutoscalingPolicyLoadBalancingUtilization LoadBalancingUtilization { get; set; }\n\nConfiguration parameters of autoscaling based on load balancer.\n\n### MaxNumReplicas\n\n public int MaxNumReplicas { get; set; }\n\nThe maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas.\n\n### MinNumReplicas\n\n public int MinNumReplicas { get; set; }\n\nThe minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed.\n\n### Mode\n\n public string Mode { get; set; }\n\nDefines the operating mode for this policy. The following modes are available: - OFF: Disables the autoscaler but maintains its configuration. - ONLY_SCALE_OUT: Restricts the autoscaler to add VM instances only. - ON: Enables all autoscaler activities according to its policy. For more information, see \"Turning off or restricting an autoscaler\"\nCheck the Mode enum for the list of possible values.\n\n### ScaleInControl\n\n public AutoscalingPolicyScaleInControl ScaleInControl { get; set; }\n\n### ScalingSchedules\n\n public MapField\u003cstring, AutoscalingPolicyScalingSchedule\u003e ScalingSchedules { get; }\n\nScaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed."]]