Module autoscale

@pulumi/azure > autoscale

class Setting

extends CustomResource

Manages an AutoScale Setting which can be applied to Virtual Machine Scale Sets, App Services and other scalable resources.

NOTE: This resource has been deprecated in favour of the azurerm_monitor_autoscale_setting resource and will be removed in the next major version of the AzureRM Provider. The new resource shares the same fields as this one, and information on migrating across can be found in this guide.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const testResourceGroup = new azure.core.ResourceGroup("test", {
    location: "West US",
    name: "autoscalingTest",
});
const testScaleSet = new azure.compute.ScaleSet("test", {});
const testSetting = new azure.autoscale.Setting("test", {
    location: testResourceGroup.location,
    name: "myAutoscaleSetting",
    notification: {
        email: {
            customEmails: ["admin@contoso.com"],
            sendToSubscriptionAdministrator: true,
            sendToSubscriptionCoAdministrator: true,
        },
    },
    profiles: [{
        capacity: {
            default: 1,
            maximum: 10,
            minimum: 1,
        },
        name: "defaultProfile",
        rules: [
            {
                metricTrigger: {
                    metricName: "Percentage CPU",
                    metricResourceId: testScaleSet.id,
                    operator: "GreaterThan",
                    statistic: "Average",
                    threshold: 75,
                    timeAggregation: "Average",
                    timeGrain: "PT1M",
                    timeWindow: "PT5M",
                },
                scaleAction: {
                    cooldown: "PT1M",
                    direction: "Increase",
                    type: "ChangeCount",
                    value: 1,
                },
            },
            {
                metricTrigger: {
                    metricName: "Percentage CPU",
                    metricResourceId: testScaleSet.id,
                    operator: "LessThan",
                    statistic: "Average",
                    threshold: 25,
                    timeAggregation: "Average",
                    timeGrain: "PT1M",
                    timeWindow: "PT5M",
                },
                scaleAction: {
                    cooldown: "PT1M",
                    direction: "Decrease",
                    type: "ChangeCount",
                    value: 1,
                },
            },
        ],
    }],
    resourceGroupName: testResourceGroup.name,
    targetResourceId: testScaleSet.id,
});

Example Usage (repeating on weekends)

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const testResourceGroup = new azure.core.ResourceGroup("test", {
    location: "West US",
    name: "autoscalingTest",
});
const testScaleSet = new azure.compute.ScaleSet("test", {});
const testSetting = new azure.autoscale.Setting("test", {
    location: testResourceGroup.location,
    name: "myAutoscaleSetting",
    notification: {
        email: {
            customEmails: ["admin@contoso.com"],
            sendToSubscriptionAdministrator: true,
            sendToSubscriptionCoAdministrator: true,
        },
    },
    profiles: [{
        capacity: {
            default: 1,
            maximum: 10,
            minimum: 1,
        },
        name: "Weekends",
        recurrence: {
            days: [
                "Saturday",
                "Sunday",
            ],
            frequency: "Week",
            hours: 12,
            minutes: 0,
            timezone: "Pacific Standard Time",
        },
        rules: [
            {
                metricTrigger: {
                    metricName: "Percentage CPU",
                    metricResourceId: testScaleSet.id,
                    operator: "GreaterThan",
                    statistic: "Average",
                    threshold: 90,
                    timeAggregation: "Average",
                    timeGrain: "PT1M",
                    timeWindow: "PT5M",
                },
                scaleAction: {
                    cooldown: "PT1M",
                    direction: "Increase",
                    type: "ChangeCount",
                    value: 2,
                },
            },
            {
                metricTrigger: {
                    metricName: "Percentage CPU",
                    metricResourceId: testScaleSet.id,
                    operator: "LessThan",
                    statistic: "Average",
                    threshold: 10,
                    timeAggregation: "Average",
                    timeGrain: "PT1M",
                    timeWindow: "PT5M",
                },
                scaleAction: {
                    cooldown: "PT1M",
                    direction: "Decrease",
                    type: "ChangeCount",
                    value: 2,
                },
            },
        ],
    }],
    resourceGroupName: testResourceGroup.name,
    targetResourceId: testScaleSet.id,
});

Example Usage (for fixed dates)

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const testResourceGroup = new azure.core.ResourceGroup("test", {
    location: "West US",
    name: "autoscalingTest",
});
const testScaleSet = new azure.compute.ScaleSet("test", {});
const testSetting = new azure.autoscale.Setting("test", {
    enabled: true,
    location: testResourceGroup.location,
    name: "myAutoscaleSetting",
    notification: {
        email: {
            customEmails: ["admin@contoso.com"],
            sendToSubscriptionAdministrator: true,
            sendToSubscriptionCoAdministrator: true,
        },
    },
    profiles: [{
        capacity: {
            default: 1,
            maximum: 10,
            minimum: 1,
        },
        fixedDate: {
            end: "2020-07-31T23:59:59Z",
            start: "2020-07-01T00:00:00Z",
            timezone: "Pacific Standard Time",
        },
        name: "forJuly",
        rules: [
            {
                metricTrigger: {
                    metricName: "Percentage CPU",
                    metricResourceId: testScaleSet.id,
                    operator: "GreaterThan",
                    statistic: "Average",
                    threshold: 90,
                    timeAggregation: "Average",
                    timeGrain: "PT1M",
                    timeWindow: "PT5M",
                },
                scaleAction: {
                    cooldown: "PT1M",
                    direction: "Increase",
                    type: "ChangeCount",
                    value: 2,
                },
            },
            {
                metricTrigger: {
                    metricName: "Percentage CPU",
                    metricResourceId: testScaleSet.id,
                    operator: "LessThan",
                    statistic: "Average",
                    threshold: 10,
                    timeAggregation: "Average",
                    timeGrain: "PT1M",
                    timeWindow: "PT5M",
                },
                scaleAction: {
                    cooldown: "PT1M",
                    direction: "Decrease",
                    type: "ChangeCount",
                    value: 2,
                },
            },
        ],
    }],
    resourceGroupName: testResourceGroup.name,
    targetResourceId: testScaleSet.id,
});

constructor

new Setting(name: string, args: SettingArgs, opts?: pulumi.CustomResourceOptions)

Create a Setting resource with the given unique name, arguments, and options.

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: SettingState, opts?: pulumi.CustomResourceOptions): Setting

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

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property enabled

public enabled: pulumi.Output<boolean | undefined>;

Specifies whether automatic scaling is enabled for the target resource. Defaults to true.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property location

public location: pulumi.Output<string>;

Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.

property name

public name: pulumi.Output<string>;

The name of the AutoScale Setting. Changing this forces a new resource to be created.

property notification

public notification: pulumi.Output<{
    email: undefined | {
        customEmails: string[];
        sendToSubscriptionAdministrator: undefined | false | true;
        sendToSubscriptionCoAdministrator: undefined | false | true;
    };
    webhooks: {
        properties: undefined | {[key: string]: any};
        serviceUri: string;
    }[];
} | undefined>;

Specifies a notification block as defined below.

property profiles

public profiles: pulumi.Output<{
    capacity: {
        default: number;
        maximum: number;
        minimum: number;
    };
    fixedDate: undefined | {
        end: string;
        start: string;
        timezone: undefined | string;
    };
    name: string;
    recurrence: undefined | {
        days: string[];
        hours: number;
        minutes: number;
        timezone: undefined | string;
    };
    rules: {
        metricTrigger: {
            metricName: string;
            metricResourceId: string;
            operator: string;
            statistic: string;
            threshold: number;
            timeAggregation: string;
            timeGrain: string;
            timeWindow: string;
        };
        scaleAction: {
            cooldown: string;
            direction: string;
            type: string;
            value: number;
        };
    }[];
}[]>;

Specifies one or more (up to 20) profile blocks as defined below.

property resourceGroupName

public resourceGroupName: pulumi.Output<string>;

The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.

property tags

public tags: pulumi.Output<{[key: string]: any}>;

A mapping of tags to assign to the resource.

property targetResourceId

public targetResourceId: pulumi.Output<string>;

Specifies the resource ID of the resource that the autoscale setting should be added to.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

interface SettingArgs

The set of arguments for constructing a Setting resource.

property enabled

enabled?: pulumi.Input<boolean>;

Specifies whether automatic scaling is enabled for the target resource. Defaults to true.

property location

location?: pulumi.Input<string>;

Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.

property name

name?: pulumi.Input<string>;

The name of the AutoScale Setting. Changing this forces a new resource to be created.

property notification

notification?: pulumi.Input<{
    email: pulumi.Input<{
        customEmails: pulumi.Input<pulumi.Input<string>[]>;
        sendToSubscriptionAdministrator: pulumi.Input<boolean>;
        sendToSubscriptionCoAdministrator: pulumi.Input<boolean>;
    }>;
    webhooks: pulumi.Input<pulumi.Input<{
        properties: pulumi.Input<{[key: string]: any}>;
        serviceUri: pulumi.Input<string>;
    }>[]>;
}>;

Specifies a notification block as defined below.

property profiles

profiles: pulumi.Input<pulumi.Input<{
    capacity: pulumi.Input<{
        default: pulumi.Input<number>;
        maximum: pulumi.Input<number>;
        minimum: pulumi.Input<number>;
    }>;
    fixedDate: pulumi.Input<{
        end: pulumi.Input<string>;
        start: pulumi.Input<string>;
        timezone: pulumi.Input<string>;
    }>;
    name: pulumi.Input<string>;
    recurrence: pulumi.Input<{
        days: pulumi.Input<pulumi.Input<string>[]>;
        hours: pulumi.Input<number>;
        minutes: pulumi.Input<number>;
        timezone: pulumi.Input<string>;
    }>;
    rules: pulumi.Input<pulumi.Input<{
        metricTrigger: pulumi.Input<{
            metricName: pulumi.Input<string>;
            metricResourceId: pulumi.Input<string>;
            operator: pulumi.Input<string>;
            statistic: pulumi.Input<string>;
            threshold: pulumi.Input<number>;
            timeAggregation: pulumi.Input<string>;
            timeGrain: pulumi.Input<string>;
            timeWindow: pulumi.Input<string>;
        }>;
        scaleAction: pulumi.Input<{
            cooldown: pulumi.Input<string>;
            direction: pulumi.Input<string>;
            type: pulumi.Input<string>;
            value: pulumi.Input<number>;
        }>;
    }>[]>;
}>[]>;

Specifies one or more (up to 20) profile blocks as defined below.

property resourceGroupName

resourceGroupName: pulumi.Input<string>;

The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.

property tags

tags?: pulumi.Input<{[key: string]: any}>;

A mapping of tags to assign to the resource.

property targetResourceId

targetResourceId: pulumi.Input<string>;

Specifies the resource ID of the resource that the autoscale setting should be added to.

interface SettingState

Input properties used for looking up and filtering Setting resources.

property enabled

enabled?: pulumi.Input<boolean>;

Specifies whether automatic scaling is enabled for the target resource. Defaults to true.

property location

location?: pulumi.Input<string>;

Specifies the supported Azure location where the AutoScale Setting should exist. Changing this forces a new resource to be created.

property name

name?: pulumi.Input<string>;

The name of the AutoScale Setting. Changing this forces a new resource to be created.

property notification

notification?: pulumi.Input<{
    email: pulumi.Input<{
        customEmails: pulumi.Input<pulumi.Input<string>[]>;
        sendToSubscriptionAdministrator: pulumi.Input<boolean>;
        sendToSubscriptionCoAdministrator: pulumi.Input<boolean>;
    }>;
    webhooks: pulumi.Input<pulumi.Input<{
        properties: pulumi.Input<{[key: string]: any}>;
        serviceUri: pulumi.Input<string>;
    }>[]>;
}>;

Specifies a notification block as defined below.

property profiles

profiles?: pulumi.Input<pulumi.Input<{
    capacity: pulumi.Input<{
        default: pulumi.Input<number>;
        maximum: pulumi.Input<number>;
        minimum: pulumi.Input<number>;
    }>;
    fixedDate: pulumi.Input<{
        end: pulumi.Input<string>;
        start: pulumi.Input<string>;
        timezone: pulumi.Input<string>;
    }>;
    name: pulumi.Input<string>;
    recurrence: pulumi.Input<{
        days: pulumi.Input<pulumi.Input<string>[]>;
        hours: pulumi.Input<number>;
        minutes: pulumi.Input<number>;
        timezone: pulumi.Input<string>;
    }>;
    rules: pulumi.Input<pulumi.Input<{
        metricTrigger: pulumi.Input<{
            metricName: pulumi.Input<string>;
            metricResourceId: pulumi.Input<string>;
            operator: pulumi.Input<string>;
            statistic: pulumi.Input<string>;
            threshold: pulumi.Input<number>;
            timeAggregation: pulumi.Input<string>;
            timeGrain: pulumi.Input<string>;
            timeWindow: pulumi.Input<string>;
        }>;
        scaleAction: pulumi.Input<{
            cooldown: pulumi.Input<string>;
            direction: pulumi.Input<string>;
            type: pulumi.Input<string>;
            value: pulumi.Input<number>;
        }>;
    }>[]>;
}>[]>;

Specifies one or more (up to 20) profile blocks as defined below.

property resourceGroupName

resourceGroupName?: pulumi.Input<string>;

The name of the Resource Group in the AutoScale Setting should be created. Changing this forces a new resource to be created.

property tags

tags?: pulumi.Input<{[key: string]: any}>;

A mapping of tags to assign to the resource.

property targetResourceId

targetResourceId?: pulumi.Input<string>;

Specifies the resource ID of the resource that the autoscale setting should be added to.