gcp logo
Google Cloud Classic v6.57.0, May 30 23

gcp.compute.Autoscalar

Explore with Pulumi AI

Deprecated:

gcp.compute.Autoscalar has been deprecated in favor of gcp.compute.Autoscaler

Represents an Autoscaler resource.

Autoscalers allow you to automatically scale virtual machine instances in managed instance groups according to an autoscaling policy that you define.

To get more information about Autoscaler, see:

Example Usage

Autoscaler Single Instance

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var debian9 = Gcp.Compute.GetImage.Invoke(new()
    {
        Family = "debian-11",
        Project = "debian-cloud",
    });

    var defaultInstanceTemplate = new Gcp.Compute.InstanceTemplate("defaultInstanceTemplate", new()
    {
        MachineType = "e2-medium",
        CanIpForward = false,
        Tags = new[]
        {
            "foo",
            "bar",
        },
        Disks = new[]
        {
            new Gcp.Compute.Inputs.InstanceTemplateDiskArgs
            {
                SourceImage = debian9.Apply(getImageResult => getImageResult.Id),
            },
        },
        NetworkInterfaces = new[]
        {
            new Gcp.Compute.Inputs.InstanceTemplateNetworkInterfaceArgs
            {
                Network = "default",
            },
        },
        Metadata = 
        {
            { "foo", "bar" },
        },
        ServiceAccount = new Gcp.Compute.Inputs.InstanceTemplateServiceAccountArgs
        {
            Scopes = new[]
            {
                "userinfo-email",
                "compute-ro",
                "storage-ro",
            },
        },
    }, new CustomResourceOptions
    {
        Provider = google_beta,
    });

    var defaultTargetPool = new Gcp.Compute.TargetPool("defaultTargetPool", new()
    {
    }, new CustomResourceOptions
    {
        Provider = google_beta,
    });

    var defaultInstanceGroupManager = new Gcp.Compute.InstanceGroupManager("defaultInstanceGroupManager", new()
    {
        Zone = "us-central1-f",
        Versions = new[]
        {
            new Gcp.Compute.Inputs.InstanceGroupManagerVersionArgs
            {
                InstanceTemplate = defaultInstanceTemplate.Id,
                Name = "primary",
            },
        },
        TargetPools = new[]
        {
            defaultTargetPool.Id,
        },
        BaseInstanceName = "autoscaler-sample",
    }, new CustomResourceOptions
    {
        Provider = google_beta,
    });

    var defaultAutoscaler = new Gcp.Compute.Autoscaler("defaultAutoscaler", new()
    {
        Zone = "us-central1-f",
        Target = defaultInstanceGroupManager.Id,
        AutoscalingPolicy = new Gcp.Compute.Inputs.AutoscalerAutoscalingPolicyArgs
        {
            MaxReplicas = 5,
            MinReplicas = 1,
            CooldownPeriod = 60,
            Metrics = new[]
            {
                new Gcp.Compute.Inputs.AutoscalerAutoscalingPolicyMetricArgs
                {
                    Name = "pubsub.googleapis.com/subscription/num_undelivered_messages",
                    Filter = "resource.type = pubsub_subscription AND resource.label.subscription_id = our-subscription",
                    SingleInstanceAssignment = 65535,
                },
            },
        },
    }, new CustomResourceOptions
    {
        Provider = google_beta,
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		debian9, err := compute.LookupImage(ctx, &compute.LookupImageArgs{
			Family:  pulumi.StringRef("debian-11"),
			Project: pulumi.StringRef("debian-cloud"),
		}, nil)
		if err != nil {
			return err
		}
		defaultInstanceTemplate, err := compute.NewInstanceTemplate(ctx, "defaultInstanceTemplate", &compute.InstanceTemplateArgs{
			MachineType:  pulumi.String("e2-medium"),
			CanIpForward: pulumi.Bool(false),
			Tags: pulumi.StringArray{
				pulumi.String("foo"),
				pulumi.String("bar"),
			},
			Disks: compute.InstanceTemplateDiskArray{
				&compute.InstanceTemplateDiskArgs{
					SourceImage: *pulumi.String(debian9.Id),
				},
			},
			NetworkInterfaces: compute.InstanceTemplateNetworkInterfaceArray{
				&compute.InstanceTemplateNetworkInterfaceArgs{
					Network: pulumi.String("default"),
				},
			},
			Metadata: pulumi.AnyMap{
				"foo": pulumi.Any("bar"),
			},
			ServiceAccount: &compute.InstanceTemplateServiceAccountArgs{
				Scopes: pulumi.StringArray{
					pulumi.String("userinfo-email"),
					pulumi.String("compute-ro"),
					pulumi.String("storage-ro"),
				},
			},
		}, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		defaultTargetPool, err := compute.NewTargetPool(ctx, "defaultTargetPool", nil, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		defaultInstanceGroupManager, err := compute.NewInstanceGroupManager(ctx, "defaultInstanceGroupManager", &compute.InstanceGroupManagerArgs{
			Zone: pulumi.String("us-central1-f"),
			Versions: compute.InstanceGroupManagerVersionArray{
				&compute.InstanceGroupManagerVersionArgs{
					InstanceTemplate: defaultInstanceTemplate.ID(),
					Name:             pulumi.String("primary"),
				},
			},
			TargetPools: pulumi.StringArray{
				defaultTargetPool.ID(),
			},
			BaseInstanceName: pulumi.String("autoscaler-sample"),
		}, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		_, err = compute.NewAutoscaler(ctx, "defaultAutoscaler", &compute.AutoscalerArgs{
			Zone:   pulumi.String("us-central1-f"),
			Target: defaultInstanceGroupManager.ID(),
			AutoscalingPolicy: &compute.AutoscalerAutoscalingPolicyArgs{
				MaxReplicas:    pulumi.Int(5),
				MinReplicas:    pulumi.Int(1),
				CooldownPeriod: pulumi.Int(60),
				Metrics: compute.AutoscalerAutoscalingPolicyMetricArray{
					&compute.AutoscalerAutoscalingPolicyMetricArgs{
						Name:                     pulumi.String("pubsub.googleapis.com/subscription/num_undelivered_messages"),
						Filter:                   pulumi.String("resource.type = pubsub_subscription AND resource.label.subscription_id = our-subscription"),
						SingleInstanceAssignment: pulumi.Float64(65535),
					},
				},
			},
		}, pulumi.Provider(google_beta))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetImageArgs;
import com.pulumi.gcp.compute.InstanceTemplate;
import com.pulumi.gcp.compute.InstanceTemplateArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateNetworkInterfaceArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateServiceAccountArgs;
import com.pulumi.gcp.compute.TargetPool;
import com.pulumi.gcp.compute.TargetPoolArgs;
import com.pulumi.gcp.compute.InstanceGroupManager;
import com.pulumi.gcp.compute.InstanceGroupManagerArgs;
import com.pulumi.gcp.compute.inputs.InstanceGroupManagerVersionArgs;
import com.pulumi.gcp.compute.Autoscaler;
import com.pulumi.gcp.compute.AutoscalerArgs;
import com.pulumi.gcp.compute.inputs.AutoscalerAutoscalingPolicyArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var debian9 = ComputeFunctions.getImage(GetImageArgs.builder()
            .family("debian-11")
            .project("debian-cloud")
            .build());

        var defaultInstanceTemplate = new InstanceTemplate("defaultInstanceTemplate", InstanceTemplateArgs.builder()        
            .machineType("e2-medium")
            .canIpForward(false)
            .tags(            
                "foo",
                "bar")
            .disks(InstanceTemplateDiskArgs.builder()
                .sourceImage(debian9.applyValue(getImageResult -> getImageResult.id()))
                .build())
            .networkInterfaces(InstanceTemplateNetworkInterfaceArgs.builder()
                .network("default")
                .build())
            .metadata(Map.of("foo", "bar"))
            .serviceAccount(InstanceTemplateServiceAccountArgs.builder()
                .scopes(                
                    "userinfo-email",
                    "compute-ro",
                    "storage-ro")
                .build())
            .build(), CustomResourceOptions.builder()
                .provider(google_beta)
                .build());

        var defaultTargetPool = new TargetPool("defaultTargetPool", TargetPoolArgs.Empty, CustomResourceOptions.builder()
            .provider(google_beta)
            .build());

        var defaultInstanceGroupManager = new InstanceGroupManager("defaultInstanceGroupManager", InstanceGroupManagerArgs.builder()        
            .zone("us-central1-f")
            .versions(InstanceGroupManagerVersionArgs.builder()
                .instanceTemplate(defaultInstanceTemplate.id())
                .name("primary")
                .build())
            .targetPools(defaultTargetPool.id())
            .baseInstanceName("autoscaler-sample")
            .build(), CustomResourceOptions.builder()
                .provider(google_beta)
                .build());

        var defaultAutoscaler = new Autoscaler("defaultAutoscaler", AutoscalerArgs.builder()        
            .zone("us-central1-f")
            .target(defaultInstanceGroupManager.id())
            .autoscalingPolicy(AutoscalerAutoscalingPolicyArgs.builder()
                .maxReplicas(5)
                .minReplicas(1)
                .cooldownPeriod(60)
                .metrics(AutoscalerAutoscalingPolicyMetricArgs.builder()
                    .name("pubsub.googleapis.com/subscription/num_undelivered_messages")
                    .filter("resource.type = pubsub_subscription AND resource.label.subscription_id = our-subscription")
                    .singleInstanceAssignment(65535)
                    .build())
                .build())
            .build(), CustomResourceOptions.builder()
                .provider(google_beta)
                .build());

    }
}
import pulumi
import pulumi_gcp as gcp

debian9 = gcp.compute.get_image(family="debian-11",
    project="debian-cloud")
default_instance_template = gcp.compute.InstanceTemplate("defaultInstanceTemplate",
    machine_type="e2-medium",
    can_ip_forward=False,
    tags=[
        "foo",
        "bar",
    ],
    disks=[gcp.compute.InstanceTemplateDiskArgs(
        source_image=debian9.id,
    )],
    network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
        network="default",
    )],
    metadata={
        "foo": "bar",
    },
    service_account=gcp.compute.InstanceTemplateServiceAccountArgs(
        scopes=[
            "userinfo-email",
            "compute-ro",
            "storage-ro",
        ],
    ),
    opts=pulumi.ResourceOptions(provider=google_beta))
default_target_pool = gcp.compute.TargetPool("defaultTargetPool", opts=pulumi.ResourceOptions(provider=google_beta))
default_instance_group_manager = gcp.compute.InstanceGroupManager("defaultInstanceGroupManager",
    zone="us-central1-f",
    versions=[gcp.compute.InstanceGroupManagerVersionArgs(
        instance_template=default_instance_template.id,
        name="primary",
    )],
    target_pools=[default_target_pool.id],
    base_instance_name="autoscaler-sample",
    opts=pulumi.ResourceOptions(provider=google_beta))
default_autoscaler = gcp.compute.Autoscaler("defaultAutoscaler",
    zone="us-central1-f",
    target=default_instance_group_manager.id,
    autoscaling_policy=gcp.compute.AutoscalerAutoscalingPolicyArgs(
        max_replicas=5,
        min_replicas=1,
        cooldown_period=60,
        metrics=[gcp.compute.AutoscalerAutoscalingPolicyMetricArgs(
            name="pubsub.googleapis.com/subscription/num_undelivered_messages",
            filter="resource.type = pubsub_subscription AND resource.label.subscription_id = our-subscription",
            single_instance_assignment=65535,
        )],
    ),
    opts=pulumi.ResourceOptions(provider=google_beta))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const debian9 = gcp.compute.getImage({
    family: "debian-11",
    project: "debian-cloud",
});
const defaultInstanceTemplate = new gcp.compute.InstanceTemplate("defaultInstanceTemplate", {
    machineType: "e2-medium",
    canIpForward: false,
    tags: [
        "foo",
        "bar",
    ],
    disks: [{
        sourceImage: debian9.then(debian9 => debian9.id),
    }],
    networkInterfaces: [{
        network: "default",
    }],
    metadata: {
        foo: "bar",
    },
    serviceAccount: {
        scopes: [
            "userinfo-email",
            "compute-ro",
            "storage-ro",
        ],
    },
}, {
    provider: google_beta,
});
const defaultTargetPool = new gcp.compute.TargetPool("defaultTargetPool", {}, {
    provider: google_beta,
});
const defaultInstanceGroupManager = new gcp.compute.InstanceGroupManager("defaultInstanceGroupManager", {
    zone: "us-central1-f",
    versions: [{
        instanceTemplate: defaultInstanceTemplate.id,
        name: "primary",
    }],
    targetPools: [defaultTargetPool.id],
    baseInstanceName: "autoscaler-sample",
}, {
    provider: google_beta,
});
const defaultAutoscaler = new gcp.compute.Autoscaler("defaultAutoscaler", {
    zone: "us-central1-f",
    target: defaultInstanceGroupManager.id,
    autoscalingPolicy: {
        maxReplicas: 5,
        minReplicas: 1,
        cooldownPeriod: 60,
        metrics: [{
            name: "pubsub.googleapis.com/subscription/num_undelivered_messages",
            filter: "resource.type = pubsub_subscription AND resource.label.subscription_id = our-subscription",
            singleInstanceAssignment: 65535,
        }],
    },
}, {
    provider: google_beta,
});
resources:
  defaultAutoscaler:
    type: gcp:compute:Autoscaler
    properties:
      zone: us-central1-f
      target: ${defaultInstanceGroupManager.id}
      autoscalingPolicy:
        maxReplicas: 5
        minReplicas: 1
        cooldownPeriod: 60
        metrics:
          - name: pubsub.googleapis.com/subscription/num_undelivered_messages
            filter: resource.type = pubsub_subscription AND resource.label.subscription_id = our-subscription
            singleInstanceAssignment: 65535
    options:
      provider: ${["google-beta"]}
  defaultInstanceTemplate:
    type: gcp:compute:InstanceTemplate
    properties:
      machineType: e2-medium
      canIpForward: false
      tags:
        - foo
        - bar
      disks:
        - sourceImage: ${debian9.id}
      networkInterfaces:
        - network: default
      metadata:
        foo: bar
      serviceAccount:
        scopes:
          - userinfo-email
          - compute-ro
          - storage-ro
    options:
      provider: ${["google-beta"]}
  defaultTargetPool:
    type: gcp:compute:TargetPool
    options:
      provider: ${["google-beta"]}
  defaultInstanceGroupManager:
    type: gcp:compute:InstanceGroupManager
    properties:
      zone: us-central1-f
      versions:
        - instanceTemplate: ${defaultInstanceTemplate.id}
          name: primary
      targetPools:
        - ${defaultTargetPool.id}
      baseInstanceName: autoscaler-sample
    options:
      provider: ${["google-beta"]}
variables:
  debian9:
    fn::invoke:
      Function: gcp:compute:getImage
      Arguments:
        family: debian-11
        project: debian-cloud

Autoscaler Basic

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var debian9 = Gcp.Compute.GetImage.Invoke(new()
    {
        Family = "debian-11",
        Project = "debian-cloud",
    });

    var foobarInstanceTemplate = new Gcp.Compute.InstanceTemplate("foobarInstanceTemplate", new()
    {
        MachineType = "e2-medium",
        CanIpForward = false,
        Tags = new[]
        {
            "foo",
            "bar",
        },
        Disks = new[]
        {
            new Gcp.Compute.Inputs.InstanceTemplateDiskArgs
            {
                SourceImage = debian9.Apply(getImageResult => getImageResult.Id),
            },
        },
        NetworkInterfaces = new[]
        {
            new Gcp.Compute.Inputs.InstanceTemplateNetworkInterfaceArgs
            {
                Network = "default",
            },
        },
        Metadata = 
        {
            { "foo", "bar" },
        },
        ServiceAccount = new Gcp.Compute.Inputs.InstanceTemplateServiceAccountArgs
        {
            Scopes = new[]
            {
                "userinfo-email",
                "compute-ro",
                "storage-ro",
            },
        },
    });

    var foobarTargetPool = new Gcp.Compute.TargetPool("foobarTargetPool");

    var foobarInstanceGroupManager = new Gcp.Compute.InstanceGroupManager("foobarInstanceGroupManager", new()
    {
        Zone = "us-central1-f",
        Versions = new[]
        {
            new Gcp.Compute.Inputs.InstanceGroupManagerVersionArgs
            {
                InstanceTemplate = foobarInstanceTemplate.Id,
                Name = "primary",
            },
        },
        TargetPools = new[]
        {
            foobarTargetPool.Id,
        },
        BaseInstanceName = "foobar",
    });

    var foobarAutoscaler = new Gcp.Compute.Autoscaler("foobarAutoscaler", new()
    {
        Zone = "us-central1-f",
        Target = foobarInstanceGroupManager.Id,
        AutoscalingPolicy = new Gcp.Compute.Inputs.AutoscalerAutoscalingPolicyArgs
        {
            MaxReplicas = 5,
            MinReplicas = 1,
            CooldownPeriod = 60,
            CpuUtilization = new Gcp.Compute.Inputs.AutoscalerAutoscalingPolicyCpuUtilizationArgs
            {
                Target = 0.5,
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		debian9, err := compute.LookupImage(ctx, &compute.LookupImageArgs{
			Family:  pulumi.StringRef("debian-11"),
			Project: pulumi.StringRef("debian-cloud"),
		}, nil)
		if err != nil {
			return err
		}
		foobarInstanceTemplate, err := compute.NewInstanceTemplate(ctx, "foobarInstanceTemplate", &compute.InstanceTemplateArgs{
			MachineType:  pulumi.String("e2-medium"),
			CanIpForward: pulumi.Bool(false),
			Tags: pulumi.StringArray{
				pulumi.String("foo"),
				pulumi.String("bar"),
			},
			Disks: compute.InstanceTemplateDiskArray{
				&compute.InstanceTemplateDiskArgs{
					SourceImage: *pulumi.String(debian9.Id),
				},
			},
			NetworkInterfaces: compute.InstanceTemplateNetworkInterfaceArray{
				&compute.InstanceTemplateNetworkInterfaceArgs{
					Network: pulumi.String("default"),
				},
			},
			Metadata: pulumi.AnyMap{
				"foo": pulumi.Any("bar"),
			},
			ServiceAccount: &compute.InstanceTemplateServiceAccountArgs{
				Scopes: pulumi.StringArray{
					pulumi.String("userinfo-email"),
					pulumi.String("compute-ro"),
					pulumi.String("storage-ro"),
				},
			},
		})
		if err != nil {
			return err
		}
		foobarTargetPool, err := compute.NewTargetPool(ctx, "foobarTargetPool", nil)
		if err != nil {
			return err
		}
		foobarInstanceGroupManager, err := compute.NewInstanceGroupManager(ctx, "foobarInstanceGroupManager", &compute.InstanceGroupManagerArgs{
			Zone: pulumi.String("us-central1-f"),
			Versions: compute.InstanceGroupManagerVersionArray{
				&compute.InstanceGroupManagerVersionArgs{
					InstanceTemplate: foobarInstanceTemplate.ID(),
					Name:             pulumi.String("primary"),
				},
			},
			TargetPools: pulumi.StringArray{
				foobarTargetPool.ID(),
			},
			BaseInstanceName: pulumi.String("foobar"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewAutoscaler(ctx, "foobarAutoscaler", &compute.AutoscalerArgs{
			Zone:   pulumi.String("us-central1-f"),
			Target: foobarInstanceGroupManager.ID(),
			AutoscalingPolicy: &compute.AutoscalerAutoscalingPolicyArgs{
				MaxReplicas:    pulumi.Int(5),
				MinReplicas:    pulumi.Int(1),
				CooldownPeriod: pulumi.Int(60),
				CpuUtilization: &compute.AutoscalerAutoscalingPolicyCpuUtilizationArgs{
					Target: pulumi.Float64(0.5),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetImageArgs;
import com.pulumi.gcp.compute.InstanceTemplate;
import com.pulumi.gcp.compute.InstanceTemplateArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateNetworkInterfaceArgs;
import com.pulumi.gcp.compute.inputs.InstanceTemplateServiceAccountArgs;
import com.pulumi.gcp.compute.TargetPool;
import com.pulumi.gcp.compute.InstanceGroupManager;
import com.pulumi.gcp.compute.InstanceGroupManagerArgs;
import com.pulumi.gcp.compute.inputs.InstanceGroupManagerVersionArgs;
import com.pulumi.gcp.compute.Autoscaler;
import com.pulumi.gcp.compute.AutoscalerArgs;
import com.pulumi.gcp.compute.inputs.AutoscalerAutoscalingPolicyArgs;
import com.pulumi.gcp.compute.inputs.AutoscalerAutoscalingPolicyCpuUtilizationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var debian9 = ComputeFunctions.getImage(GetImageArgs.builder()
            .family("debian-11")
            .project("debian-cloud")
            .build());

        var foobarInstanceTemplate = new InstanceTemplate("foobarInstanceTemplate", InstanceTemplateArgs.builder()        
            .machineType("e2-medium")
            .canIpForward(false)
            .tags(            
                "foo",
                "bar")
            .disks(InstanceTemplateDiskArgs.builder()
                .sourceImage(debian9.applyValue(getImageResult -> getImageResult.id()))
                .build())
            .networkInterfaces(InstanceTemplateNetworkInterfaceArgs.builder()
                .network("default")
                .build())
            .metadata(Map.of("foo", "bar"))
            .serviceAccount(InstanceTemplateServiceAccountArgs.builder()
                .scopes(                
                    "userinfo-email",
                    "compute-ro",
                    "storage-ro")
                .build())
            .build());

        var foobarTargetPool = new TargetPool("foobarTargetPool");

        var foobarInstanceGroupManager = new InstanceGroupManager("foobarInstanceGroupManager", InstanceGroupManagerArgs.builder()        
            .zone("us-central1-f")
            .versions(InstanceGroupManagerVersionArgs.builder()
                .instanceTemplate(foobarInstanceTemplate.id())
                .name("primary")
                .build())
            .targetPools(foobarTargetPool.id())
            .baseInstanceName("foobar")
            .build());

        var foobarAutoscaler = new Autoscaler("foobarAutoscaler", AutoscalerArgs.builder()        
            .zone("us-central1-f")
            .target(foobarInstanceGroupManager.id())
            .autoscalingPolicy(AutoscalerAutoscalingPolicyArgs.builder()
                .maxReplicas(5)
                .minReplicas(1)
                .cooldownPeriod(60)
                .cpuUtilization(AutoscalerAutoscalingPolicyCpuUtilizationArgs.builder()
                    .target(0.5)
                    .build())
                .build())
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

debian9 = gcp.compute.get_image(family="debian-11",
    project="debian-cloud")
foobar_instance_template = gcp.compute.InstanceTemplate("foobarInstanceTemplate",
    machine_type="e2-medium",
    can_ip_forward=False,
    tags=[
        "foo",
        "bar",
    ],
    disks=[gcp.compute.InstanceTemplateDiskArgs(
        source_image=debian9.id,
    )],
    network_interfaces=[gcp.compute.InstanceTemplateNetworkInterfaceArgs(
        network="default",
    )],
    metadata={
        "foo": "bar",
    },
    service_account=gcp.compute.InstanceTemplateServiceAccountArgs(
        scopes=[
            "userinfo-email",
            "compute-ro",
            "storage-ro",
        ],
    ))
foobar_target_pool = gcp.compute.TargetPool("foobarTargetPool")
foobar_instance_group_manager = gcp.compute.InstanceGroupManager("foobarInstanceGroupManager",
    zone="us-central1-f",
    versions=[gcp.compute.InstanceGroupManagerVersionArgs(
        instance_template=foobar_instance_template.id,
        name="primary",
    )],
    target_pools=[foobar_target_pool.id],
    base_instance_name="foobar")
foobar_autoscaler = gcp.compute.Autoscaler("foobarAutoscaler",
    zone="us-central1-f",
    target=foobar_instance_group_manager.id,
    autoscaling_policy=gcp.compute.AutoscalerAutoscalingPolicyArgs(
        max_replicas=5,
        min_replicas=1,
        cooldown_period=60,
        cpu_utilization=gcp.compute.AutoscalerAutoscalingPolicyCpuUtilizationArgs(
            target=0.5,
        ),
    ))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const debian9 = gcp.compute.getImage({
    family: "debian-11",
    project: "debian-cloud",
});
const foobarInstanceTemplate = new gcp.compute.InstanceTemplate("foobarInstanceTemplate", {
    machineType: "e2-medium",
    canIpForward: false,
    tags: [
        "foo",
        "bar",
    ],
    disks: [{
        sourceImage: debian9.then(debian9 => debian9.id),
    }],
    networkInterfaces: [{
        network: "default",
    }],
    metadata: {
        foo: "bar",
    },
    serviceAccount: {
        scopes: [
            "userinfo-email",
            "compute-ro",
            "storage-ro",
        ],
    },
});
const foobarTargetPool = new gcp.compute.TargetPool("foobarTargetPool", {});
const foobarInstanceGroupManager = new gcp.compute.InstanceGroupManager("foobarInstanceGroupManager", {
    zone: "us-central1-f",
    versions: [{
        instanceTemplate: foobarInstanceTemplate.id,
        name: "primary",
    }],
    targetPools: [foobarTargetPool.id],
    baseInstanceName: "foobar",
});
const foobarAutoscaler = new gcp.compute.Autoscaler("foobarAutoscaler", {
    zone: "us-central1-f",
    target: foobarInstanceGroupManager.id,
    autoscalingPolicy: {
        maxReplicas: 5,
        minReplicas: 1,
        cooldownPeriod: 60,
        cpuUtilization: {
            target: 0.5,
        },
    },
});
resources:
  foobarAutoscaler:
    type: gcp:compute:Autoscaler
    properties:
      zone: us-central1-f
      target: ${foobarInstanceGroupManager.id}
      autoscalingPolicy:
        maxReplicas: 5
        minReplicas: 1
        cooldownPeriod: 60
        cpuUtilization:
          target: 0.5
  foobarInstanceTemplate:
    type: gcp:compute:InstanceTemplate
    properties:
      machineType: e2-medium
      canIpForward: false
      tags:
        - foo
        - bar
      disks:
        - sourceImage: ${debian9.id}
      networkInterfaces:
        - network: default
      metadata:
        foo: bar
      serviceAccount:
        scopes:
          - userinfo-email
          - compute-ro
          - storage-ro
  foobarTargetPool:
    type: gcp:compute:TargetPool
  foobarInstanceGroupManager:
    type: gcp:compute:InstanceGroupManager
    properties:
      zone: us-central1-f
      versions:
        - instanceTemplate: ${foobarInstanceTemplate.id}
          name: primary
      targetPools:
        - ${foobarTargetPool.id}
      baseInstanceName: foobar
variables:
  debian9:
    fn::invoke:
      Function: gcp:compute:getImage
      Arguments:
        family: debian-11
        project: debian-cloud

Create Autoscalar Resource

new Autoscalar(name: string, args: AutoscalarArgs, opts?: CustomResourceOptions);
@overload
def Autoscalar(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               autoscaling_policy: Optional[AutoscalarAutoscalingPolicyArgs] = None,
               description: Optional[str] = None,
               name: Optional[str] = None,
               project: Optional[str] = None,
               target: Optional[str] = None,
               zone: Optional[str] = None)
@overload
def Autoscalar(resource_name: str,
               args: AutoscalarArgs,
               opts: Optional[ResourceOptions] = None)
func NewAutoscalar(ctx *Context, name string, args AutoscalarArgs, opts ...ResourceOption) (*Autoscalar, error)
public Autoscalar(string name, AutoscalarArgs args, CustomResourceOptions? opts = null)
public Autoscalar(String name, AutoscalarArgs args)
public Autoscalar(String name, AutoscalarArgs args, CustomResourceOptions options)
type: gcp:compute:Autoscalar
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args AutoscalarArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args AutoscalarArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args AutoscalarArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args AutoscalarArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args AutoscalarArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Autoscalar Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Autoscalar resource accepts the following input properties:

AutoscalingPolicy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

Target string

URL of the managed instance group that this autoscaler will scale.

Description string

A description of a scaling schedule.


(Optional) An optional description of this resource.

Name string

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Zone string

URL of the zone where the instance group resides.

AutoscalingPolicy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

Target string

URL of the managed instance group that this autoscaler will scale.

Description string

A description of a scaling schedule.


(Optional) An optional description of this resource.

Name string

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Zone string

URL of the zone where the instance group resides.

autoscalingPolicy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

target String

URL of the managed instance group that this autoscaler will scale.

description String

A description of a scaling schedule.


(Optional) An optional description of this resource.

name String

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

zone String

URL of the zone where the instance group resides.

autoscalingPolicy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

target string

URL of the managed instance group that this autoscaler will scale.

description string

A description of a scaling schedule.


(Optional) An optional description of this resource.

name string

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

zone string

URL of the zone where the instance group resides.

autoscaling_policy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

target str

URL of the managed instance group that this autoscaler will scale.

description str

A description of a scaling schedule.


(Optional) An optional description of this resource.

name str

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

zone str

URL of the zone where the instance group resides.

autoscalingPolicy Property Map

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

target String

URL of the managed instance group that this autoscaler will scale.

description String

A description of a scaling schedule.


(Optional) An optional description of this resource.

name String

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

zone String

URL of the zone where the instance group resides.

Outputs

All input properties are implicitly available as output properties. Additionally, the Autoscalar resource produces the following output properties:

CreationTimestamp string

Creation timestamp in RFC3339 text format.

Id string

The provider-assigned unique ID for this managed resource.

SelfLink string

The URI of the created resource.

CreationTimestamp string

Creation timestamp in RFC3339 text format.

Id string

The provider-assigned unique ID for this managed resource.

SelfLink string

The URI of the created resource.

creationTimestamp String

Creation timestamp in RFC3339 text format.

id String

The provider-assigned unique ID for this managed resource.

selfLink String

The URI of the created resource.

creationTimestamp string

Creation timestamp in RFC3339 text format.

id string

The provider-assigned unique ID for this managed resource.

selfLink string

The URI of the created resource.

creation_timestamp str

Creation timestamp in RFC3339 text format.

id str

The provider-assigned unique ID for this managed resource.

self_link str

The URI of the created resource.

creationTimestamp String

Creation timestamp in RFC3339 text format.

id String

The provider-assigned unique ID for this managed resource.

selfLink String

The URI of the created resource.

Look up Existing Autoscalar Resource

Get an existing Autoscalar resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: AutoscalarState, opts?: CustomResourceOptions): Autoscalar
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        autoscaling_policy: Optional[AutoscalarAutoscalingPolicyArgs] = None,
        creation_timestamp: Optional[str] = None,
        description: Optional[str] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        self_link: Optional[str] = None,
        target: Optional[str] = None,
        zone: Optional[str] = None) -> Autoscalar
func GetAutoscalar(ctx *Context, name string, id IDInput, state *AutoscalarState, opts ...ResourceOption) (*Autoscalar, error)
public static Autoscalar Get(string name, Input<string> id, AutoscalarState? state, CustomResourceOptions? opts = null)
public static Autoscalar get(String name, Output<String> id, AutoscalarState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AutoscalingPolicy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

CreationTimestamp string

Creation timestamp in RFC3339 text format.

Description string

A description of a scaling schedule.


(Optional) An optional description of this resource.

Name string

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

SelfLink string

The URI of the created resource.

Target string

URL of the managed instance group that this autoscaler will scale.

Zone string

URL of the zone where the instance group resides.

AutoscalingPolicy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

CreationTimestamp string

Creation timestamp in RFC3339 text format.

Description string

A description of a scaling schedule.


(Optional) An optional description of this resource.

Name string

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

Project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

SelfLink string

The URI of the created resource.

Target string

URL of the managed instance group that this autoscaler will scale.

Zone string

URL of the zone where the instance group resides.

autoscalingPolicy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

creationTimestamp String

Creation timestamp in RFC3339 text format.

description String

A description of a scaling schedule.


(Optional) An optional description of this resource.

name String

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

selfLink String

The URI of the created resource.

target String

URL of the managed instance group that this autoscaler will scale.

zone String

URL of the zone where the instance group resides.

autoscalingPolicy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

creationTimestamp string

Creation timestamp in RFC3339 text format.

description string

A description of a scaling schedule.


(Optional) An optional description of this resource.

name string

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

project string

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

selfLink string

The URI of the created resource.

target string

URL of the managed instance group that this autoscaler will scale.

zone string

URL of the zone where the instance group resides.

autoscaling_policy AutoscalarAutoscalingPolicyArgs

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

creation_timestamp str

Creation timestamp in RFC3339 text format.

description str

A description of a scaling schedule.


(Optional) An optional description of this resource.

name str

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

project str

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

self_link str

The URI of the created resource.

target str

URL of the managed instance group that this autoscaler will scale.

zone str

URL of the zone where the instance group resides.

autoscalingPolicy Property Map

The configuration parameters for the autoscaling algorithm. You can define one or more of the policies for an autoscaler: cpuUtilization, customMetricUtilizations, and loadBalancingUtilization. If none of these are specified, the default will be to autoscale based on cpuUtilization to 0.6 or 60%. Structure is documented below.

creationTimestamp String

Creation timestamp in RFC3339 text format.

description String

A description of a scaling schedule.


(Optional) An optional description of this resource.

name String

Name of the resource. The name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

project String

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

selfLink String

The URI of the created resource.

target String

URL of the managed instance group that this autoscaler will scale.

zone String

URL of the zone where the instance group resides.

Supporting Types

AutoscalarAutoscalingPolicy

MaxReplicas int

The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas.

MinReplicas int

The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed.

CooldownPeriod int

The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.

CpuUtilization AutoscalarAutoscalingPolicyCpuUtilization

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. Structure is documented below.

LoadBalancingUtilization AutoscalarAutoscalingPolicyLoadBalancingUtilization

Configuration parameters of autoscaling based on a load balancer. Structure is documented below.

Metrics List<AutoscalarAutoscalingPolicyMetric>

Configuration parameters of autoscaling based on a custom metric. Structure is documented below.

Mode string

Defines operating mode for this policy. Default value is ON. Possible values are: OFF, ONLY_UP, ON.

ScaleDownControl AutoscalarAutoscalingPolicyScaleDownControl

Defines scale down controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

ScaleInControl AutoscalarAutoscalingPolicyScaleInControl

Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

ScalingSchedules List<AutoscalarAutoscalingPolicyScalingSchedule>

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap. Structure is documented below.

MaxReplicas int

The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas.

MinReplicas int

The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed.

CooldownPeriod int

The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.

CpuUtilization AutoscalarAutoscalingPolicyCpuUtilization

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. Structure is documented below.

LoadBalancingUtilization AutoscalarAutoscalingPolicyLoadBalancingUtilization

Configuration parameters of autoscaling based on a load balancer. Structure is documented below.

Metrics []AutoscalarAutoscalingPolicyMetric

Configuration parameters of autoscaling based on a custom metric. Structure is documented below.

Mode string

Defines operating mode for this policy. Default value is ON. Possible values are: OFF, ONLY_UP, ON.

ScaleDownControl AutoscalarAutoscalingPolicyScaleDownControl

Defines scale down controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

ScaleInControl AutoscalarAutoscalingPolicyScaleInControl

Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

ScalingSchedules []AutoscalarAutoscalingPolicyScalingSchedule

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap. Structure is documented below.

maxReplicas Integer

The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas.

minReplicas Integer

The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed.

cooldownPeriod Integer

The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.

cpuUtilization AutoscalarAutoscalingPolicyCpuUtilization

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. Structure is documented below.

loadBalancingUtilization AutoscalarAutoscalingPolicyLoadBalancingUtilization

Configuration parameters of autoscaling based on a load balancer. Structure is documented below.

metrics List<AutoscalarAutoscalingPolicyMetric>

Configuration parameters of autoscaling based on a custom metric. Structure is documented below.

mode String

Defines operating mode for this policy. Default value is ON. Possible values are: OFF, ONLY_UP, ON.

scaleDownControl AutoscalarAutoscalingPolicyScaleDownControl

Defines scale down controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

scaleInControl AutoscalarAutoscalingPolicyScaleInControl

Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

scalingSchedules List<AutoscalarAutoscalingPolicyScalingSchedule>

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap. Structure is documented below.

maxReplicas number

The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas.

minReplicas number

The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed.

cooldownPeriod number

The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.

cpuUtilization AutoscalarAutoscalingPolicyCpuUtilization

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. Structure is documented below.

loadBalancingUtilization AutoscalarAutoscalingPolicyLoadBalancingUtilization

Configuration parameters of autoscaling based on a load balancer. Structure is documented below.

metrics AutoscalarAutoscalingPolicyMetric[]

Configuration parameters of autoscaling based on a custom metric. Structure is documented below.

mode string

Defines operating mode for this policy. Default value is ON. Possible values are: OFF, ONLY_UP, ON.

scaleDownControl AutoscalarAutoscalingPolicyScaleDownControl

Defines scale down controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

scaleInControl AutoscalarAutoscalingPolicyScaleInControl

Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

scalingSchedules AutoscalarAutoscalingPolicyScalingSchedule[]

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap. Structure is documented below.

max_replicas int

The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas.

min_replicas int

The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed.

cooldown_period int

The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.

cpu_utilization AutoscalarAutoscalingPolicyCpuUtilization

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. Structure is documented below.

load_balancing_utilization AutoscalarAutoscalingPolicyLoadBalancingUtilization

Configuration parameters of autoscaling based on a load balancer. Structure is documented below.

metrics Sequence[AutoscalarAutoscalingPolicyMetric]

Configuration parameters of autoscaling based on a custom metric. Structure is documented below.

mode str

Defines operating mode for this policy. Default value is ON. Possible values are: OFF, ONLY_UP, ON.

scale_down_control AutoscalarAutoscalingPolicyScaleDownControl

Defines scale down controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

scale_in_control AutoscalarAutoscalingPolicyScaleInControl

Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

scaling_schedules Sequence[AutoscalarAutoscalingPolicyScalingSchedule]

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap. Structure is documented below.

maxReplicas Number

The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas.

minReplicas Number

The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. If not provided, autoscaler will choose a default value depending on maximum number of instances allowed.

cooldownPeriod Number

The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. The default time autoscaler waits is 60 seconds. Virtual machine initialization times might vary because of numerous factors. We recommend that you test how long an instance may take to initialize. To do this, create an instance and time the startup process.

cpuUtilization Property Map

Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. Structure is documented below.

loadBalancingUtilization Property Map

Configuration parameters of autoscaling based on a load balancer. Structure is documented below.

metrics List<Property Map>

Configuration parameters of autoscaling based on a custom metric. Structure is documented below.

mode String

Defines operating mode for this policy. Default value is ON. Possible values are: OFF, ONLY_UP, ON.

scaleDownControl Property Map

Defines scale down controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

scaleInControl Property Map

Defines scale in controls to reduce the risk of response latency and outages due to abrupt scale-in events Structure is documented below.

scalingSchedules List<Property Map>

Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler and they can overlap. Structure is documented below.

AutoscalarAutoscalingPolicyCpuUtilization

Target double

The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization.

PredictiveMethod string

Indicates whether predictive autoscaling based on CPU metric is enabled. Valid values are:

  • NONE (default). No predictive method is used. The autoscaler scales the group to meet current demand based on real-time metrics.
  • OPTIMIZE_AVAILABILITY. Predictive autoscaling improves availability by monitoring daily and weekly load patterns and scaling out ahead of anticipated demand.
Target float64

The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization.

PredictiveMethod string

Indicates whether predictive autoscaling based on CPU metric is enabled. Valid values are:

  • NONE (default). No predictive method is used. The autoscaler scales the group to meet current demand based on real-time metrics.
  • OPTIMIZE_AVAILABILITY. Predictive autoscaling improves availability by monitoring daily and weekly load patterns and scaling out ahead of anticipated demand.
target Double

The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization.

predictiveMethod String

Indicates whether predictive autoscaling based on CPU metric is enabled. Valid values are:

  • NONE (default). No predictive method is used. The autoscaler scales the group to meet current demand based on real-time metrics.
  • OPTIMIZE_AVAILABILITY. Predictive autoscaling improves availability by monitoring daily and weekly load patterns and scaling out ahead of anticipated demand.
target number

The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization.

predictiveMethod string

Indicates whether predictive autoscaling based on CPU metric is enabled. Valid values are:

  • NONE (default). No predictive method is used. The autoscaler scales the group to meet current demand based on real-time metrics.
  • OPTIMIZE_AVAILABILITY. Predictive autoscaling improves availability by monitoring daily and weekly load patterns and scaling out ahead of anticipated demand.
target float

The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization.

predictive_method str

Indicates whether predictive autoscaling based on CPU metric is enabled. Valid values are:

  • NONE (default). No predictive method is used. The autoscaler scales the group to meet current demand based on real-time metrics.
  • OPTIMIZE_AVAILABILITY. Predictive autoscaling improves availability by monitoring daily and weekly load patterns and scaling out ahead of anticipated demand.
target Number

The target CPU utilization that the autoscaler should maintain. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. If the CPU level is below the target utilization, the autoscaler scales down the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. If the average CPU is above the target utilization, the autoscaler scales up until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization.

predictiveMethod String

Indicates whether predictive autoscaling based on CPU metric is enabled. Valid values are:

  • NONE (default). No predictive method is used. The autoscaler scales the group to meet current demand based on real-time metrics.
  • OPTIMIZE_AVAILABILITY. Predictive autoscaling improves availability by monitoring daily and weekly load patterns and scaling out ahead of anticipated demand.

AutoscalarAutoscalingPolicyLoadBalancingUtilization

Target double

Fraction of backend capacity utilization (set in HTTP(s) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8.

Target float64

Fraction of backend capacity utilization (set in HTTP(s) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8.

target Double

Fraction of backend capacity utilization (set in HTTP(s) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8.

target number

Fraction of backend capacity utilization (set in HTTP(s) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8.

target float

Fraction of backend capacity utilization (set in HTTP(s) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8.

target Number

Fraction of backend capacity utilization (set in HTTP(s) load balancing configuration) that autoscaler should maintain. Must be a positive float value. If not defined, the default is 0.8.

AutoscalarAutoscalingPolicyMetric

Name string

The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. The metric must have a value type of INT64 or DOUBLE.

Filter string

A filter string to be used as the filter string for a Stackdriver Monitoring TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. You can only use the AND operator for joining selectors. You can only use direct equality comparison operator (=) without any functions for each selector. You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. If not specified, the type defaults to gce_instance. You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value.

SingleInstanceAssignment double

If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. The autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. For example, a good metric to use with the target is pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead.

Target double

The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. For example, a good metric to use as a utilizationTarget is www.googleapis.com/compute/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances.

Type string

Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Possible values are: GAUGE, DELTA_PER_SECOND, DELTA_PER_MINUTE.

Name string

The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. The metric must have a value type of INT64 or DOUBLE.

Filter string

A filter string to be used as the filter string for a Stackdriver Monitoring TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. You can only use the AND operator for joining selectors. You can only use direct equality comparison operator (=) without any functions for each selector. You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. If not specified, the type defaults to gce_instance. You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value.

SingleInstanceAssignment float64

If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. The autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. For example, a good metric to use with the target is pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead.

Target float64

The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. For example, a good metric to use as a utilizationTarget is www.googleapis.com/compute/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances.

Type string

Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Possible values are: GAUGE, DELTA_PER_SECOND, DELTA_PER_MINUTE.

name String

The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. The metric must have a value type of INT64 or DOUBLE.

filter String

A filter string to be used as the filter string for a Stackdriver Monitoring TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. You can only use the AND operator for joining selectors. You can only use direct equality comparison operator (=) without any functions for each selector. You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. If not specified, the type defaults to gce_instance. You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value.

singleInstanceAssignment Double

If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. The autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. For example, a good metric to use with the target is pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead.

target Double

The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. For example, a good metric to use as a utilizationTarget is www.googleapis.com/compute/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances.

type String

Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Possible values are: GAUGE, DELTA_PER_SECOND, DELTA_PER_MINUTE.

name string

The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. The metric must have a value type of INT64 or DOUBLE.

filter string

A filter string to be used as the filter string for a Stackdriver Monitoring TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. You can only use the AND operator for joining selectors. You can only use direct equality comparison operator (=) without any functions for each selector. You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. If not specified, the type defaults to gce_instance. You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value.

singleInstanceAssignment number

If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. The autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. For example, a good metric to use with the target is pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead.

target number

The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. For example, a good metric to use as a utilizationTarget is www.googleapis.com/compute/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances.

type string

Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Possible values are: GAUGE, DELTA_PER_SECOND, DELTA_PER_MINUTE.

name str

The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. The metric must have a value type of INT64 or DOUBLE.

filter str

A filter string to be used as the filter string for a Stackdriver Monitoring TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. You can only use the AND operator for joining selectors. You can only use direct equality comparison operator (=) without any functions for each selector. You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. If not specified, the type defaults to gce_instance. You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value.

single_instance_assignment float

If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. The autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. For example, a good metric to use with the target is pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead.

target float

The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. For example, a good metric to use as a utilizationTarget is www.googleapis.com/compute/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances.

type str

Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Possible values are: GAUGE, DELTA_PER_SECOND, DELTA_PER_MINUTE.

name String

The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. The metric must have a value type of INT64 or DOUBLE.

filter String

A filter string to be used as the filter string for a Stackdriver Monitoring TimeSeries.list API call. This filter is used to select a specific TimeSeries for the purpose of autoscaling and to determine whether the metric is exporting per-instance or per-group data. You can only use the AND operator for joining selectors. You can only use direct equality comparison operator (=) without any functions for each selector. You can specify the metric in both the filter string and in the metric field. However, if specified in both places, the metric must be identical. The monitored resource type determines what kind of values are expected for the metric. If it is a gce_instance, the autoscaler expects the metric to include a separate TimeSeries for each instance in a group. In such a case, you cannot filter on resource labels. If the resource type is any other value, the autoscaler expects this metric to contain values that apply to the entire autoscaled instance group and resource label filtering can be performed to point autoscaler at the correct TimeSeries to scale upon. This is called a per-group metric for the purpose of autoscaling. If not specified, the type defaults to gce_instance. You should provide a filter that is selective enough to pick just one TimeSeries for the autoscaled group or for each of the instances (if you are using gce_instance resource type). If multiple TimeSeries are returned upon the query execution, the autoscaler will sum their respective values to obtain its scaling value.

singleInstanceAssignment Number

If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. The autoscaler will keep the number of instances proportional to the value of this metric, the metric itself should not change value due to group resizing. For example, a good metric to use with the target is pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead.

target Number

The target value of the metric that autoscaler should maintain. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. For example, a good metric to use as a utilizationTarget is www.googleapis.com/compute/instance/network/received_bytes_count. The autoscaler will work to keep this value constant for each of the instances.

type String

Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Possible values are: GAUGE, DELTA_PER_SECOND, DELTA_PER_MINUTE.

AutoscalarAutoscalingPolicyScaleDownControl

MaxScaledDownReplicas AutoscalarAutoscalingPolicyScaleDownControlMaxScaledDownReplicas

A nested object resource Structure is documented below.

TimeWindowSec int

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

MaxScaledDownReplicas AutoscalarAutoscalingPolicyScaleDownControlMaxScaledDownReplicas

A nested object resource Structure is documented below.

TimeWindowSec int

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

maxScaledDownReplicas AutoscalarAutoscalingPolicyScaleDownControlMaxScaledDownReplicas

A nested object resource Structure is documented below.

timeWindowSec Integer

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

maxScaledDownReplicas AutoscalarAutoscalingPolicyScaleDownControlMaxScaledDownReplicas

A nested object resource Structure is documented below.

timeWindowSec number

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

max_scaled_down_replicas AutoscalarAutoscalingPolicyScaleDownControlMaxScaledDownReplicas

A nested object resource Structure is documented below.

time_window_sec int

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

maxScaledDownReplicas Property Map

A nested object resource Structure is documented below.

timeWindowSec Number

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

AutoscalarAutoscalingPolicyScaleDownControlMaxScaledDownReplicas

Fixed int

Specifies a fixed number of VM instances. This must be a positive integer.

Percent int

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

Fixed int

Specifies a fixed number of VM instances. This must be a positive integer.

Percent int

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

fixed Integer

Specifies a fixed number of VM instances. This must be a positive integer.

percent Integer

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

fixed number

Specifies a fixed number of VM instances. This must be a positive integer.

percent number

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

fixed int

Specifies a fixed number of VM instances. This must be a positive integer.

percent int

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

fixed Number

Specifies a fixed number of VM instances. This must be a positive integer.

percent Number

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

AutoscalarAutoscalingPolicyScaleInControl

MaxScaledInReplicas AutoscalarAutoscalingPolicyScaleInControlMaxScaledInReplicas

A nested object resource Structure is documented below.

TimeWindowSec int

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

MaxScaledInReplicas AutoscalarAutoscalingPolicyScaleInControlMaxScaledInReplicas

A nested object resource Structure is documented below.

TimeWindowSec int

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

maxScaledInReplicas AutoscalarAutoscalingPolicyScaleInControlMaxScaledInReplicas

A nested object resource Structure is documented below.

timeWindowSec Integer

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

maxScaledInReplicas AutoscalarAutoscalingPolicyScaleInControlMaxScaledInReplicas

A nested object resource Structure is documented below.

timeWindowSec number

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

max_scaled_in_replicas AutoscalarAutoscalingPolicyScaleInControlMaxScaledInReplicas

A nested object resource Structure is documented below.

time_window_sec int

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

maxScaledInReplicas Property Map

A nested object resource Structure is documented below.

timeWindowSec Number

How long back autoscaling should look when computing recommendations to include directives regarding slower scale down, as described above.

AutoscalarAutoscalingPolicyScaleInControlMaxScaledInReplicas

Fixed int

Specifies a fixed number of VM instances. This must be a positive integer.

Percent int

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

Fixed int

Specifies a fixed number of VM instances. This must be a positive integer.

Percent int

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

fixed Integer

Specifies a fixed number of VM instances. This must be a positive integer.

percent Integer

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

fixed number

Specifies a fixed number of VM instances. This must be a positive integer.

percent number

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

fixed int

Specifies a fixed number of VM instances. This must be a positive integer.

percent int

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

fixed Number

Specifies a fixed number of VM instances. This must be a positive integer.

percent Number

Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%.

AutoscalarAutoscalingPolicyScalingSchedule

DurationSec int

The duration of time intervals (in seconds) for which this scaling schedule will be running. The minimum allowed value is 300.

MinRequiredReplicas int

Minimum number of VM instances that autoscaler will recommend in time intervals starting according to schedule.

Name string

The identifier for this object. Format specified above.

Schedule string

The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field).

Description string

An optional description of this resource.

Disabled bool

A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect.

TimeZone string

The time zone to be used when interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.

DurationSec int

The duration of time intervals (in seconds) for which this scaling schedule will be running. The minimum allowed value is 300.

MinRequiredReplicas int

Minimum number of VM instances that autoscaler will recommend in time intervals starting according to schedule.

Name string

The identifier for this object. Format specified above.

Schedule string

The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field).

Description string

An optional description of this resource.

Disabled bool

A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect.

TimeZone string

The time zone to be used when interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.

durationSec Integer

The duration of time intervals (in seconds) for which this scaling schedule will be running. The minimum allowed value is 300.

minRequiredReplicas Integer

Minimum number of VM instances that autoscaler will recommend in time intervals starting according to schedule.

name String

The identifier for this object. Format specified above.

schedule String

The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field).

description String

An optional description of this resource.

disabled Boolean

A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect.

timeZone String

The time zone to be used when interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.

durationSec number

The duration of time intervals (in seconds) for which this scaling schedule will be running. The minimum allowed value is 300.

minRequiredReplicas number

Minimum number of VM instances that autoscaler will recommend in time intervals starting according to schedule.

name string

The identifier for this object. Format specified above.

schedule string

The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field).

description string

An optional description of this resource.

disabled boolean

A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect.

timeZone string

The time zone to be used when interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.

duration_sec int

The duration of time intervals (in seconds) for which this scaling schedule will be running. The minimum allowed value is 300.

min_required_replicas int

Minimum number of VM instances that autoscaler will recommend in time intervals starting according to schedule.

name str

The identifier for this object. Format specified above.

schedule str

The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field).

description str

An optional description of this resource.

disabled bool

A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect.

time_zone str

The time zone to be used when interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.

durationSec Number

The duration of time intervals (in seconds) for which this scaling schedule will be running. The minimum allowed value is 300.

minRequiredReplicas Number

Minimum number of VM instances that autoscaler will recommend in time intervals starting according to schedule.

name String

The identifier for this object. Format specified above.

schedule String

The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field).

description String

An optional description of this resource.

disabled Boolean

A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect.

timeZone String

The time zone to be used when interpreting the schedule. The value of this field must be a time zone name from the tz database: http://en.wikipedia.org/wiki/Tz_database.

Import

Autoscaler can be imported using any of these accepted formats

 $ pulumi import gcp:compute/autoscalar:Autoscalar default projects/{{project}}/zones/{{zone}}/autoscalers/{{name}}
 $ pulumi import gcp:compute/autoscalar:Autoscalar default {{project}}/{{zone}}/{{name}}
 $ pulumi import gcp:compute/autoscalar:Autoscalar default {{zone}}/{{name}}
 $ pulumi import gcp:compute/autoscalar:Autoscalar default {{name}}

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.