Create
Creates an instance group in the specified folder. This method starts an operation that can be cancelled by another operation.
- TypeScript
- Python
import {
cloudApi,
decodeMessage,
serviceClients,
Session,
waitForOperation,
} from "@yandex-cloud/nodejs-sdk";
const AttachedDiskSpec_Mode =
cloudApi.compute.instancegroup_instance_group.AttachedDiskSpec_Mode;
const AttachedFilesystemSpec_Mode =
cloudApi.compute.instancegroup_instance_group.AttachedFilesystemSpec_Mode;
const AutoScale_AutoScaleType =
cloudApi.compute.instancegroup_instance_group.AutoScale_AutoScaleType;
const CreateInstanceGroupRequest =
cloudApi.compute.instancegroup_instance_group_service
.CreateInstanceGroupRequest;
const CustomRule_MetricType =
cloudApi.compute.instancegroup_instance_group.CustomRule_MetricType;
const CustomRule_RuleType =
cloudApi.compute.instancegroup_instance_group.CustomRule_RuleType;
const DeployPolicy_MinimalAction =
cloudApi.compute.instancegroup_instance_group.DeployPolicy_MinimalAction;
const DeployPolicy_Strategy =
cloudApi.compute.instancegroup_instance_group.DeployPolicy_Strategy;
const HostAffinityRule_Operator =
cloudApi.compute.instancegroup_instance_group.HostAffinityRule_Operator;
const InstanceGroup =
cloudApi.compute.instancegroup_instance_group.InstanceGroup;
const IpVersion = cloudApi.compute.instancegroup_instance_group.IpVersion;
const MetadataOption =
cloudApi.compute.instancegroup_instance_group.MetadataOption;
const NetworkSettings_Type =
cloudApi.compute.instancegroup_instance_group.NetworkSettings_Type;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.InstanceGroupServiceClient);
const operation = await client.create(
CreateInstanceGroupRequest.fromPartial({
folderId: "folderId",
// name: "name",
// description: "description",
// labels: {"key": "labels"},
instanceTemplate: {
// description: "description",
// labels: {"key": "labels"},
platformId: "platformId",
resourcesSpec: {
// memory: 0,
// cores: 0,
// coreFraction: 0,
// gpus: 0
},
// metadata: {"key": "metadata"},
bootDiskSpec: {
mode: AttachedDiskSpec_Mode.READ_ONLY,
// deviceName: "deviceName",
diskSpec: {
// description: "description",
typeId: "typeId",
// size: 0,
// imageId: "imageId",
// snapshotId: "snapshotId",
// preserveAfterInstanceDelete: true
},
// diskId: "diskId",
// name: "name"
},
// secondaryDiskSpecs: [{
// mode: AttachedDiskSpec_Mode.READ_ONLY,
// deviceName: "deviceName",
// diskSpec: {
// description: "description",
// typeId: "typeId",
// size: 0,
// imageId: "imageId",
// snapshotId: "snapshotId",
// preserveAfterInstanceDelete: true
// },
// diskId: "diskId",
// name: "name"
// }],
networkInterfaceSpecs: [
{
// networkId: "networkId",
// subnetIds: ["subnetIds"],
// primaryV4AddressSpec: {
// oneToOneNatSpec: {
// ipVersion: IpVersion.IPV4,
// address: "address",
// dnsRecordSpecs: [{
// fqdn: "fqdn",
// dnsZoneId: "dnsZoneId",
// ttl: 0,
// ptr: true
// }]
// },
// dnsRecordSpecs: [{
// fqdn: "fqdn",
// dnsZoneId: "dnsZoneId",
// ttl: 0,
// ptr: true
// }],
// address: "address"
// },
// primaryV6AddressSpec: {
// oneToOneNatSpec: {
// ipVersion: IpVersion.IPV4,
// address: "address",
// dnsRecordSpecs: [{
// fqdn: "fqdn",
// dnsZoneId: "dnsZoneId",
// ttl: 0,
// ptr: true
// }]
// },
// dnsRecordSpecs: [{
// fqdn: "fqdn",
// dnsZoneId: "dnsZoneId",
// ttl: 0,
// ptr: true
// }],
// address: "address"
// },
// securityGroupIds: ["securityGroupIds"]
},
],
// schedulingPolicy: {
// preemptible: true
// },
// serviceAccountId: "serviceAccountId",
// networkSettings: {
// type: NetworkSettings_Type.STANDARD
// },
// name: "name",
// hostname: "hostname",
// placementPolicy: {
// placementGroupId: "placementGroupId",
// hostAffinityRules: [{
// key: "key",
// op: HostAffinityRule_Operator.IN,
// values: ["values"]
// }]
// },
// filesystemSpecs: [{
// mode: AttachedFilesystemSpec_Mode.READ_ONLY,
// deviceName: "deviceName",
// filesystemId: "filesystemId"
// }],
// metadataOptions: {
// gceHttpEndpoint: MetadataOption.ENABLED,
// awsV1HttpEndpoint: MetadataOption.ENABLED,
// gceHttpToken: MetadataOption.ENABLED,
// awsV1HttpToken: MetadataOption.ENABLED
// }
},
scalePolicy: {
// fixedScale: {
// size: 0
// },
// autoScale: {
// minZoneSize: 0,
// maxSize: 0,
// measurementDuration: {
// seconds: 0,
// nanos: 0
// },
// warmupDuration: {
// seconds: 0,
// nanos: 0
// },
// stabilizationDuration: {
// seconds: 0,
// nanos: 0
// },
// initialSize: 0,
// cpuUtilizationRule: {
// utilizationTarget: 0
// },
// customRules: [{
// ruleType: CustomRule_RuleType.UTILIZATION,
// metricType: CustomRule_MetricType.GAUGE,
// metricName: "metricName",
// labels: {"key": "labels"},
// target: 0,
// folderId: "folderId",
// service: "service"
// }],
// autoScaleType: AutoScale_AutoScaleType.ZONAL
// },
// testAutoScale: {
// minZoneSize: 0,
// maxSize: 0,
// measurementDuration: {
// seconds: 0,
// nanos: 0
// },
// warmupDuration: {
// seconds: 0,
// nanos: 0
// },
// stabilizationDuration: {
// seconds: 0,
// nanos: 0
// },
// initialSize: 0,
// cpuUtilizationRule: {
// utilizationTarget: 0
// },
// customRules: [{
// ruleType: CustomRule_RuleType.UTILIZATION,
// metricType: CustomRule_MetricType.GAUGE,
// metricName: "metricName",
// labels: {"key": "labels"},
// target: 0,
// folderId: "folderId",
// service: "service"
// }],
// autoScaleType: AutoScale_AutoScaleType.ZONAL
// }
},
deployPolicy: {
// maxUnavailable: 0,
// maxDeleting: 0,
// maxCreating: 0,
// maxExpansion: 0,
// startupDuration: {
// seconds: 0,
// nanos: 0
// },
// strategy: DeployPolicy_Strategy.PROACTIVE,
// minimalAction: DeployPolicy_MinimalAction.LIVE_UPDATE
},
allocationPolicy: {
// zones: [{
// zoneId: "zoneId",
// instanceTagsPool: ["instanceTagsPool"]
// }]
},
// loadBalancerSpec: {
// targetGroupSpec: {
// name: "name",
// description: "description",
// labels: {"key": "labels"}
// },
// maxOpeningTrafficDuration: {
// seconds: 0,
// nanos: 0
// },
// ignoreHealthChecks: true
// },
// healthChecksSpec: {
// healthCheckSpecs: [{
// interval: {
// seconds: 0,
// nanos: 0
// },
// timeout: {
// seconds: 0,
// nanos: 0
// },
// unhealthyThreshold: 0,
// healthyThreshold: 0,
// tcpOptions: {
// port: 0
// },
// httpOptions: {
// port: 0,
// path: "path"
// }
// }],
// maxCheckingHealthDuration: {
// seconds: 0,
// nanos: 0
// }
// },
// serviceAccountId: "serviceAccountId",
// variables: [{
// key: "key",
// value: "value"
// }],
// deletionProtection: true,
// applicationLoadBalancerSpec: {
// targetGroupSpec: {
// name: "name",
// description: "description",
// labels: {"key": "labels"}
// },
// maxOpeningTrafficDuration: {
// seconds: 0,
// nanos: 0
// },
// ignoreHealthChecks: true
// }
})
);
const finishedOp = await waitForOperation(operation, session);
if (finishedOp.response) {
const result = decodeMessage<typeof InstanceGroup>(finishedOp.response);
console.log(result);
}
})();
import os
import grpc
import yandexcloud
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import AllocationPolicy
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import ApplicationLoadBalancerSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import ApplicationTargetGroupSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import AttachedDiskSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import AttachedFilesystemSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_service_pb2 import (
CreateInstanceGroupMetadata,
)
from yandex.cloud.compute.v1.instancegroup.instance_group_service_pb2 import (
CreateInstanceGroupRequest,
)
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import DeployPolicy
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import DnsRecordSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import HealthCheckSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import HealthChecksSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import InstanceGroup
from yandex.cloud.compute.v1.instancegroup.instance_group_service_pb2_grpc import (
InstanceGroupServiceStub,
)
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import InstanceTemplate
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import IpVersion
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import LoadBalancerSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import MetadataOption
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import MetadataOptions
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import NetworkInterfaceSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import NetworkSettings
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import OneToOneNatSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import PlacementPolicy
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import PrimaryAddressSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import ResourcesSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import ScalePolicy
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import SchedulingPolicy
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import TargetGroupSpec
from yandex.cloud.compute.v1.instancegroup.instance_group_pb2 import Variable
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(InstanceGroupServiceStub)
operation = service.Create(
CreateInstanceGroupRequest(
folder_id="folderId",
# name = "name",
# description = "description",
# labels = {"key": "labels"},
instance_template=InstanceTemplate(
# description = "description",
# labels = {"key": "labels"},
platform_id="platformId",
resources_spec=ResourcesSpec(
# memory = 0,
# cores = 0,
# core_fraction = 0,
# gpus = 0
),
# metadata = {"key": "metadata"},
boot_disk_spec=AttachedDiskSpec(
mode=AttachedDiskSpec.Mode.READ_ONLY,
# device_name = "deviceName",
disk_spec=AttachedDiskSpec.DiskSpec(
# description = "description",
type_id="typeId",
# size = 0,
# image_id = "imageId",
# snapshot_id = "snapshotId",
# preserve_after_instance_delete = true
),
# disk_id = "diskId",
# name = "name"
),
# secondary_disk_specs = [AttachedDiskSpec(
# mode = AttachedDiskSpec.Mode.READ_ONLY,
# device_name = "deviceName",
# disk_spec = AttachedDiskSpec.DiskSpec(
# description = "description",
# type_id = "typeId",
# size = 0,
# image_id = "imageId",
# snapshot_id = "snapshotId",
# preserve_after_instance_delete = true
# ),
# disk_id = "diskId",
# name = "name"
# )],
network_interface_specs=[
NetworkInterfaceSpec(
# network_id = "networkId",
# subnet_ids = ["subnetIds"],
# primary_v_4_address_spec = PrimaryAddressSpec(
# one_to_one_nat_spec = OneToOneNatSpec(
# ip_version = IpVersion.IPV4,
# address = "address",
# dns_record_specs = [DnsRecordSpec(
# fqdn = "fqdn",
# dns_zone_id = "dnsZoneId",
# ttl = 0,
# ptr = true
# )]
# ),
# dns_record_specs = [DnsRecordSpec(
# fqdn = "fqdn",
# dns_zone_id = "dnsZoneId",
# ttl = 0,
# ptr = true
# )],
# address = "address"
# ),
# primary_v_6_address_spec = PrimaryAddressSpec(
# one_to_one_nat_spec = OneToOneNatSpec(
# ip_version = IpVersion.IPV4,
# address = "address",
# dns_record_specs = [DnsRecordSpec(
# fqdn = "fqdn",
# dns_zone_id = "dnsZoneId",
# ttl = 0,
# ptr = true
# )]
# ),
# dns_record_specs = [DnsRecordSpec(
# fqdn = "fqdn",
# dns_zone_id = "dnsZoneId",
# ttl = 0,
# ptr = true
# )],
# address = "address"
# ),
# security_group_ids = ["securityGroupIds"]
)
],
# scheduling_policy = SchedulingPolicy(
# preemptible = true
# ),
# service_account_id = "serviceAccountId",
# network_settings = NetworkSettings(
# type = NetworkSettings.Type.STANDARD
# ),
# name = "name",
# hostname = "hostname",
# placement_policy = PlacementPolicy(
# placement_group_id = "placementGroupId",
# host_affinity_rules = [PlacementPolicy.HostAffinityRule(
# key = "key",
# op = HostAffinityRule.Operator.IN,
# values = ["values"]
# )]
# ),
# filesystem_specs = [AttachedFilesystemSpec(
# mode = AttachedFilesystemSpec.Mode.READ_ONLY,
# device_name = "deviceName",
# filesystem_id = "filesystemId"
# )],
# metadata_options = MetadataOptions(
# gce_http_endpoint = MetadataOption.ENABLED,
# aws_v_1_http_endpoint = MetadataOption.ENABLED,
# gce_http_token = MetadataOption.ENABLED,
# aws_v_1_http_token = MetadataOption.ENABLED
# )
),
scale_policy=ScalePolicy(
# fixed_scale = ScalePolicy.FixedScale(
# size = 0
# ),
# auto_scale = ScalePolicy.AutoScale(
# min_zone_size = 0,
# max_size = 0,
# measurement_duration = Duration(
# seconds = 0,
# nanos = 0
# ),
# warmup_duration = Duration(
# seconds = 0,
# nanos = 0
# ),
# stabilization_duration = Duration(
# seconds = 0,
# nanos = 0
# ),
# initial_size = 0,
# cpu_utilization_rule = ScalePolicy.CpuUtilizationRule(
# utilization_target = 0
# ),
# custom_rules = [ScalePolicy.CustomRule(
# rule_type = CustomRule.RuleType.UTILIZATION,
# metric_type = CustomRule.MetricType.GAUGE,
# metric_name = "metricName",
# labels = {"key": "labels"},
# target = 0,
# folder_id = "folderId",
# service = "service"
# )],
# auto_scale_type = AutoScale.AutoScaleType.ZONAL
# ),
# test_auto_scale = ScalePolicy.AutoScale(
# min_zone_size = 0,
# max_size = 0,
# measurement_duration = Duration(
# seconds = 0,
# nanos = 0
# ),
# warmup_duration = Duration(
# seconds = 0,
# nanos = 0
# ),
# stabilization_duration = Duration(
# seconds = 0,
# nanos = 0
# ),
# initial_size = 0,
# cpu_utilization_rule = ScalePolicy.CpuUtilizationRule(
# utilization_target = 0
# ),
# custom_rules = [ScalePolicy.CustomRule(
# rule_type = CustomRule.RuleType.UTILIZATION,
# metric_type = CustomRule.MetricType.GAUGE,
# metric_name = "metricName",
# labels = {"key": "labels"},
# target = 0,
# folder_id = "folderId",
# service = "service"
# )],
# auto_scale_type = AutoScale.AutoScaleType.ZONAL
# )
),
deploy_policy=DeployPolicy(
# max_unavailable = 0,
# max_deleting = 0,
# max_creating = 0,
# max_expansion = 0,
# startup_duration = Duration(
# seconds = 0,
# nanos = 0
# ),
# strategy = DeployPolicy.Strategy.PROACTIVE,
# minimal_action = DeployPolicy.MinimalAction.LIVE_UPDATE
),
allocation_policy=AllocationPolicy(
# zones = [AllocationPolicy.Zone(
# zone_id = "zoneId",
# instance_tags_pool = ["instanceTagsPool"]
# )]
),
# load_balancer_spec = LoadBalancerSpec(
# target_group_spec = TargetGroupSpec(
# name = "name",
# description = "description",
# labels = {"key": "labels"}
# ),
# max_opening_traffic_duration = Duration(
# seconds = 0,
# nanos = 0
# ),
# ignore_health_checks = true
# ),
# health_checks_spec = HealthChecksSpec(
# health_check_specs = [HealthCheckSpec(
# interval = Duration(
# seconds = 0,
# nanos = 0
# ),
# timeout = Duration(
# seconds = 0,
# nanos = 0
# ),
# unhealthy_threshold = 0,
# healthy_threshold = 0,
# tcp_options = HealthCheckSpec.TcpOptions(
# port = 0
# ),
# http_options = HealthCheckSpec.HttpOptions(
# port = 0,
# path = "path"
# )
# )],
# max_checking_health_duration = Duration(
# seconds = 0,
# nanos = 0
# )
# ),
# service_account_id = "serviceAccountId",
# variables = [Variable(
# key = "key",
# value = "value"
# )],
# deletion_protection = true,
# application_load_balancer_spec = ApplicationLoadBalancerSpec(
# target_group_spec = ApplicationTargetGroupSpec(
# name = "name",
# description = "description",
# labels = {"key": "labels"}
# ),
# max_opening_traffic_duration = Duration(
# seconds = 0,
# nanos = 0
# ),
# ignore_health_checks = true
# )
)
)
operation_result = sdk.wait_operation_and_get_result(
operation,
response_type=InstanceGroup,
meta_type=CreateInstanceGroupMetadata,
)
print(operation_result)
CreateInstanceGroupRequest
folderId
: string
ID of the folder to create an instance group in. To get the folder ID, use a yandex.cloud.resourcemanager.v1.FolderService.List request.
name
: string
Name of the instance group.
description
: string
Description of the instance group.
labels
: string
Resource labels as key:value
pairs.
instanceTemplate
: InstanceTemplate
Instance template that the instance group belongs to.
scalePolicy
: ScalePolicy
Scaling policy of the instance group.
deployPolicy
: DeployPolicy
Deployment policy of the instance group.
allocationPolicy
: AllocationPolicy
Allocation policy of the instance group by zones and regions.
loadBalancerSpec
: LoadBalancerSpec
Settings for balancing load between instances via Network Load Balancer (OSI model layer 3).
If specified, a Network Load Balancer target group containing all instances from the instance group will be created and attributed to the instance group.
healthChecksSpec
: HealthChecksSpec
Health checking specification. For more information, see Health check.
serviceAccountId
: string
ID of the service account. The service account will be used for all API calls made by the Instance Groups component on behalf of the user (for example, creating instances, adding them to load balancer target group, etc.). For more information, see Service accounts. To get the service account ID, use a yandex.cloud.iam.v1.ServiceAccountService.List request.
variables
: Variable
deletionProtection
: bool
Flag prohibiting deletion of the instance group.
Allowed values:</br>- false
: The instance group can be deleted.</br>- true
: The instance group cannot be deleted.
The default is false
.
applicationLoadBalancerSpec
: ApplicationLoadBalancerSpec
Settings for balancing load between instances via Application Load Balancer (OSI model layer 7).
If specified, an Application Load Balancer target group containing all instances from the instance group will be created and attributed to the instance group.
InstanceTemplate
description
: string
Description of the instance template.
labels
: string
Resource labels as key:value
pairs.
platformId
: string
ID of the hardware platform configuration for the instance. Platforms allows you to create various types of instances: with a large amount of memory, with a large number of cores, with a burstable performance. For more information, see Platforms.
resourcesSpec
: ResourcesSpec
Computing resources of the instance such as the amount of memory and number of cores.
metadata
: string
The metadata key:value
pairs assigned to this instance template. This includes custom metadata and predefined keys.
Metadata values may contain one of the supported placeholders: {instance_group.id} {instance.short_id} {instance.index} {instance.index_in_zone} {instance.zone_id} InstanceGroup and Instance labels may be copied to metadata following way: {instance_group.labels.some_label_key} {instance.labels.another_label_key} These placeholders will be substituted for each created instance anywhere in the value text. In the rare case the value requires to contain this placeholder explicitly, it must be escaped with double brackets, in example {instance.index}.
For example, you may use the metadata in order to provide your public SSH key to the instance. For more information, see Metadata.
bootDiskSpec
: AttachedDiskSpec
Boot disk specification that will be attached to the instance.
secondaryDiskSpecs
: AttachedDiskSpec
Array of secondary disks that will be attached to the instance.
networkInterfaceSpecs
: NetworkInterfaceSpec
Array of network interfaces that will be attached to the instance.
schedulingPolicy
: SchedulingPolicy
Scheduling policy for the instance.
serviceAccountId
: string
Service account ID for the instance.
networkSettings
: NetworkSettings
Network settings for the instance.
name
: string
Name of the instance. In order to be unique it must contain at least on of instance unique placeholders: {instance.short_id} {instance.index} combination of {instance.zone_id} and {instance.index_in_zone} Example: my-instance-{instance.index} If not set, default is used: {instance_group.id}-{instance.short_id} It may also contain another placeholders, see metadata doc for full list.
hostname
: string
Host name for the instance.
This field is used to generate the yandex.cloud.compute.v1.Instance.fqdn value.
The host name must be unique within the network and region.
If not specified, the host name will be equal to yandex.cloud.compute.v1.Instance.id of the instance
and FQDN will be <id>.auto.internal
. Otherwise FQDN will be <hostname>.<region_id>.internal
.
In order to be unique it must contain at least on of instance unique placeholders:
{instance.short_id}
{instance.index}
combination of {instance.zone_id} and {instance.index_in_zone}
Example: my-instance-{instance.index}
If not set, name
value will be used
It may also contain another placeholders, see metadata doc for full list.
placementPolicy
: PlacementPolicy
Placement Group
filesystemSpecs
: AttachedFilesystemSpec
Array of filesystems to attach to the instance.
The filesystems must reside in the same availability zone as the instance.
To use the instance with an attached filesystem, the latter must be mounted. For details, see documentation.
metadataOptions
: MetadataOptions
Metadata options for the instance
ScalePolicy
AutoScale
AutoScaleType
AUTO_SCALE_TYPE_UNSPECIFIED
ZONAL
Scale each zone independently. This is the default.
REGIONAL
Scale group as a whole.
minZoneSize
: int64
Lower limit for instance count in each zone.
maxSize
: int64
Upper limit for total instance count (across all zones). 0 means maximum limit = 100.
measurementDuration
: google.protobuf.Duration
Time in seconds allotted for averaging metrics. 1 minute by default.
warmupDuration
: google.protobuf.Duration
The warmup time of the instance in seconds. During this time, traffic is sent to the instance, but instance metrics are not collected.
stabilizationDuration
: google.protobuf.Duration
Minimum amount of time in seconds allotted for monitoring before Instance Groups can reduce the number of instances in the group. During this time, the group size doesn't decrease, even if the new metric values indicate that it should.
initialSize
: int64
Target group size.
cpuUtilizationRule
: CpuUtilizationRule
Defines an autoscaling rule based on the average CPU utilization of the instance group.
If more than one rule is specified, e.g. CPU utilization and one or more Monitoring metrics (custom_rules), the size of the instance group will be equal to the maximum of sizes calculated according to each metric.
customRules
: CustomRule
Defines an autoscaling rule based on a custom metric from Monitoring.
If more than one rule is specified, e.g. CPU utilization (cpu_utilization_rule) and one or more Monitoring metrics, the size of the instance group will be equal to the maximum of sizes calculated according to each metric.
autoScaleType
: AutoScaleType
Autoscaling type.
CpuUtilizationRule
utilizationTarget
: double
Target CPU utilization level. Instance Groups maintains this level for each availability zone.
CustomRule
RuleType
RULE_TYPE_UNSPECIFIED
UTILIZATION
This type means that the metric applies to one instance. First, Instance Groups calculates the average metric value for each instance, then averages the values for instances in one availability zone or in whole group depends on autoscaling type. This type of metric must have the
instance_id
label.WORKLOAD
This type means that the metric applies to instances in one availability zone or to whole group depends on autoscaling type. This type of metric must have the
zone_id
label if ZONAL autoscaling type is chosen.
MetricType
METRIC_TYPE_UNSPECIFIED
GAUGE
This type is used for metrics that show the metric value at a certain point in time, such as requests per second to the server on an instance. Instance Groups calculates the average metric value for the period specified in the [AutoScale.measurement_duration][7] field.
COUNTER
This type is used for metrics that monotonically increase over time, such as the total number of requests to the server on an instance. Instance Groups calculates the average value increase for the period specified in the [AutoScale.measurement_duration][8] field.
ruleType
: RuleType
Custom metric rule type. This field affects which label from
the custom metric should be used: zone_id
or instance_id
.
metricType
: MetricType
Type of custom metric. This field affects how Instance Groups calculates the average metric value.
metricName
: string
Name of custom metric in Monitoring that should be used for scaling.
labels
: string
Labels of custom metric in Monitoring that should be used for scaling.
target
: double
Target value for the custom metric. Instance Groups maintains this level for each availability zone.
folderId
: string
Folder id of custom metric in Monitoring that should be used for scaling.
service
: string
Service of custom metric in Monitoring that should be used for scaling.
FixedScale
size
: int64
Number of instances in the instance group.
One of scaleType
fixedScale
: FixedScaleManual scaling policy of the instance group.
autoScale
: AutoScaleAutomatic scaling policy of the instance group.
testAutoScale
: AutoScale
Test spec for automatic scaling policy of the instance group.
DeployPolicy
Strategy
STRATEGY_UNSPECIFIED
PROACTIVE
Instance Groups can forcefully stop a running instance. This is the default.
OPPORTUNISTIC
Instance Groups does not stop a running instance. Instead, it will wait until the instance stops itself or becomes unhealthy.
MinimalAction
MINIMAL_ACTION_UNSPECIFIED
LIVE_UPDATE
Updating an instance without stopping. This is the default.
RESTART
Updating an instance with restart: stopping and then starting the instance.
RECREATE
Re-creating an instance: deleting an instance and creating a new one.
maxUnavailable
: int64
The maximum number of running instances that can be taken offline (i.e., stopped or deleted) at the same time during the update process. If max_expansion is not specified or set to zero, max_unavailable must be set to a non-zero value.
maxDeleting
: int64
The maximum number of instances that can be deleted at the same time.
The value 0 is any number of virtual machines within the allowed values.
maxCreating
: int64
The maximum number of instances that can be created at the same time.
The value 0 is any number of virtual machines within the allowed values.
maxExpansion
: int64
The maximum number of instances that can be temporarily allocated above the group's target size during the update process. If max_unavailable is not specified or set to zero, max_expansion must be set to a non-zero value.
startupDuration
: google.protobuf.Duration
Instance startup duration. Instance will be considered up and running (and start receiving traffic) only after startup_duration has elapsed and all health checks are passed. See yandex.cloud.compute.v1.instancegroup.ManagedInstance.Status for more information.
strategy
: Strategy
Affects the lifecycle of the instance during deployment.
minimalAction
: MinimalAction
If instance update requires a less disruptive action than minimal_action, Instance Groups performs minimal_action to execute the update
AllocationPolicy
Zone
zoneId
: string
ID of the availability zone where the instance resides.
instanceTagsPool
: string
Each instance in a zone will be associated with exactly one of a tag from a pool below. All specified tags must be unique across the whole group not only the zone. It is guaranteed that during whole deploy only tags from prefix of the specified list will be used. It is possible to use tag associated with instance in templating via {instance.tag}.
zones
: Zone
List of availability zones.
LoadBalancerSpec
targetGroupSpec
: TargetGroupSpec
Specification of the target group that the instance group will be added to. For more information, see Target groups and resources.
maxOpeningTrafficDuration
: google.protobuf.Duration
Timeout for waiting for the VM to be checked by the load balancer. If the timeout is exceeded, the VM will be turned off based on the deployment policy. Specified in seconds.
ignoreHealthChecks
: bool
Do not wait load balancer health checks.
HealthChecksSpec
healthCheckSpecs
: HealthCheckSpec
Health checking specification. For more information, see Health check.
maxCheckingHealthDuration
: google.protobuf.Duration
Timeout for waiting for the VM to become healthy. If the timeout is exceeded, the VM will be turned off based on the deployment policy. Specified in seconds.
Variable
key
: string
value
: string
ApplicationLoadBalancerSpec
targetGroupSpec
: ApplicationTargetGroupSpec
Basic properties of the Application Load Balancer target group attributed to the instance group.
maxOpeningTrafficDuration
: google.protobuf.Duration
Timeout for waiting for the VM to be checked by the load balancer. If the timeout is exceeded, the VM will be turned off based on the deployment policy. Specified in seconds.
ignoreHealthChecks
: bool
Do not wait load balancer health checks.
ResourcesSpec
memory
: int64
The amount of memory available to the instance, specified in bytes.
cores
: int64
The number of cores available to the instance.
coreFraction
: int64
Baseline level of CPU performance with the ability to burst performance above that baseline level. This field sets baseline performance for each core.
gpus
: int64
The number of GPUs available to the instance.
AttachedDiskSpec
Mode
MODE_UNSPECIFIED
READ_ONLY
Read-only access.
READ_WRITE
Read/Write access.
DiskSpec
description
: string
Description of the disk.
typeId
: string
ID of the disk type.
size
: int64
Size of the disk, specified in bytes.
One of sourceOneof
imageId
: stringID of the image that will be used for disk creation.
snapshotId
: stringID of the snapshot that will be used for disk creation.
preserveAfterInstanceDelete
: bool
When set to true, disk will not be deleted even after managed instance is deleted. It will be a user's responsibility to delete such disks.
mode
: Mode
Access mode to the Disk resource.
deviceName
: string
Serial number that is reflected in the /dev/disk/by-id/ tree of a Linux operating system running within the instance.
This value can be used to reference the device for mounting, resizing, and so on, from within the instance.
diskSpec
: DiskSpec
oneof disk_spec or disk_id Disk specification that is attached to the instance. For more information, see Disks.
diskId
: string
Set to use an existing disk. To set use variables.
name
: string
When set can be later used to change DiskSpec of actual disk.
NetworkInterfaceSpec
networkId
: string
ID of the network.
subnetIds
: string
IDs of the subnets.
primaryV4AddressSpec
: PrimaryAddressSpec
Primary IPv4 address that is assigned to the instance for this network interface.
primaryV6AddressSpec
: PrimaryAddressSpec
Primary IPv6 address that is assigned to the instance for this network interface. IPv6 not available yet.
securityGroupIds
: string
IDs of security groups.
SchedulingPolicy
preemptible
: bool
Preemptible instances are stopped at least once every 24 hours, and can be stopped at any time if their resources are needed by Compute. For more information, see Preemptible Virtual Machines.
NetworkSettings
Type
TYPE_UNSPECIFIED
STANDARD
SOFTWARE_ACCELERATED
HARDWARE_ACCELERATED
type
: Type
Type of instance network.
PlacementPolicy
HostAffinityRule
Affinity definition
Operator
OPERATOR_UNSPECIFIED
IN
NOT_IN
key
: string
Affinity label or one of reserved values - 'yc.hostId', 'yc.hostGroupId'
op
: Operator
Include or exclude action
values
: string
Affinity value or host ID or host group ID
placementGroupId
: string
Identifier of placement group
hostAffinityRules
: HostAffinityRule
List of affinity rules. Scheduler will attempt to allocate instances according to order of rules.
AttachedFilesystemSpec
Mode
MODE_UNSPECIFIED
READ_ONLY
Read-only access.
READ_WRITE
Read/Write access. Default value.
mode
: Mode
Mode of access to the filesystem that should be attached.
deviceName
: string
Name of the device representing the filesystem on the instance.
The name should be used for referencing the filesystem from within the instance when it's being mounted, resized etc.
If not specified, a random value will be generated.
filesystemId
: string
ID of the filesystem that should be attached.
MetadataOptions
gceHttpEndpoint
: MetadataOption
Enabled access to GCE flavored metadata
awsV1HttpEndpoint
: MetadataOption
Enabled access to AWS flavored metadata (IMDSv1)
gceHttpToken
: MetadataOption
Enabled access to IAM credentials with GCE flavored metadata
awsV1HttpToken
: MetadataOption
Enabled access to IAM credentials with AWS flavored metadata (IMDSv1)
CpuUtilizationRule
utilizationTarget
: double
Target CPU utilization level. Instance Groups maintains this level for each availability zone.
CustomRule
RuleType
RULE_TYPE_UNSPECIFIED
UTILIZATION
This type means that the metric applies to one instance. First, Instance Groups calculates the average metric value for each instance, then averages the values for instances in one availability zone or in whole group depends on autoscaling type. This type of metric must have the
instance_id
label.WORKLOAD
This type means that the metric applies to instances in one availability zone or to whole group depends on autoscaling type. This type of metric must have the
zone_id
label if ZONAL autoscaling type is chosen.
MetricType
METRIC_TYPE_UNSPECIFIED
GAUGE
This type is used for metrics that show the metric value at a certain point in time, such as requests per second to the server on an instance. Instance Groups calculates the average metric value for the period specified in the [AutoScale.measurement_duration][16] field.
COUNTER
This type is used for metrics that monotonically increase over time, such as the total number of requests to the server on an instance. Instance Groups calculates the average value increase for the period specified in the [AutoScale.measurement_duration][17] field.
ruleType
: RuleType
Custom metric rule type. This field affects which label from
the custom metric should be used: zone_id
or instance_id
.
metricType
: MetricType
Type of custom metric. This field affects how Instance Groups calculates the average metric value.
metricName
: string
Name of custom metric in Monitoring that should be used for scaling.
labels
: string
Labels of custom metric in Monitoring that should be used for scaling.
target
: double
Target value for the custom metric. Instance Groups maintains this level for each availability zone.
folderId
: string
Folder id of custom metric in Monitoring that should be used for scaling.
service
: string
Service of custom metric in Monitoring that should be used for scaling.
FixedScale
size
: int64
Number of instances in the instance group.
AutoScale
AutoScaleType
AUTO_SCALE_TYPE_UNSPECIFIED
ZONAL
Scale each zone independently. This is the default.
REGIONAL
Scale group as a whole.
minZoneSize
: int64
Lower limit for instance count in each zone.
maxSize
: int64
Upper limit for total instance count (across all zones). 0 means maximum limit = 100.
measurementDuration
: google.protobuf.Duration
Time in seconds allotted for averaging metrics. 1 minute by default.
warmupDuration
: google.protobuf.Duration
The warmup time of the instance in seconds. During this time, traffic is sent to the instance, but instance metrics are not collected.
stabilizationDuration
: google.protobuf.Duration
Minimum amount of time in seconds allotted for monitoring before Instance Groups can reduce the number of instances in the group. During this time, the group size doesn't decrease, even if the new metric values indicate that it should.
initialSize
: int64
Target group size.
cpuUtilizationRule
: CpuUtilizationRule
Defines an autoscaling rule based on the average CPU utilization of the instance group.
If more than one rule is specified, e.g. CPU utilization and one or more Monitoring metrics (custom_rules), the size of the instance group will be equal to the maximum of sizes calculated according to each metric.
customRules
: CustomRule
Defines an autoscaling rule based on a custom metric from Monitoring.
If more than one rule is specified, e.g. CPU utilization (cpu_utilization_rule) and one or more Monitoring metrics, the size of the instance group will be equal to the maximum of sizes calculated according to each metric.
autoScaleType
: AutoScaleType
Autoscaling type.
Zone
zoneId
: string
ID of the availability zone where the instance resides.
instanceTagsPool
: string
Each instance in a zone will be associated with exactly one of a tag from a pool below. All specified tags must be unique across the whole group not only the zone. It is guaranteed that during whole deploy only tags from prefix of the specified list will be used. It is possible to use tag associated with instance in templating via {instance.tag}.
TargetGroupSpec
name
: string
Name of the target group.
description
: string
Description of the target group.
labels
: string
Resource labels as key:value
pairs.
HealthCheckSpec
TcpOptions
port
: int64
Port to use for TCP health checks.
HttpOptions
port
: int64
Port to use for HTTP health checks.
path
: string
URL path to set for health checking requests.
interval
: google.protobuf.Duration
The interval between health checks. The default is 2 seconds.
timeout
: google.protobuf.Duration
Timeout for the managed instance to return a response for the health check. The default is 1 second.
unhealthyThreshold
: int64
The number of failed health checks for the managed instance to be considered unhealthy. The default (0) is 2.
healthyThreshold
: int64
The number of successful health checks required in order for the managed instance to be considered healthy. The default (0) is 2.
One of healthCheckOptions
tcpOptions
: TcpOptionsConfiguration options for a TCP health check.
httpOptions
: HttpOptionsConfiguration options for an HTTP health check.
ApplicationTargetGroupSpec
name
: string
Name of the target group.
description
: string
Description of the target group.
labels
: string
Resource labels as key:value
pairs.
DiskSpec
description
: string
Description of the disk.
typeId
: string
ID of the disk type.
size
: int64
Size of the disk, specified in bytes.
imageId
: stringID of the image that will be used for disk creation.
snapshotId
: stringID of the snapshot that will be used for disk creation.
preserveAfterInstanceDelete
: bool
When set to true, disk will not be deleted even after managed instance is deleted. It will be a user's responsibility to delete such disks.
PrimaryAddressSpec
oneToOneNatSpec
: OneToOneNatSpec
An external IP address configuration. If not specified, then this managed instance will have no external internet access.
dnsRecordSpecs
: DnsRecordSpec
Internal DNS configuration
address
: string
Optional. Manual set static internal IP. To set use variables.
HostAffinityRule
Affinity definition
Operator
OPERATOR_UNSPECIFIED
IN
NOT_IN
key
: string
Affinity label or one of reserved values - 'yc.hostId', 'yc.hostGroupId'
op
: Operator
Include or exclude action
values
: string
Affinity value or host ID or host group ID
TcpOptions
port
: int64
Port to use for TCP health checks.
HttpOptions
port
: int64
Port to use for HTTP health checks.
path
: string
URL path to set for health checking requests.
OneToOneNatSpec
ipVersion
: IpVersion
IP version for the public IP address.
address
: string
Manual set static public IP. To set use variables. (optional)
dnsRecordSpecs
: DnsRecordSpec
External DNS configuration
DnsRecordSpec
fqdn
: string
FQDN (required)
dnsZoneId
: string
DNS zone id (optional, if not set, private zone used)
ttl
: int64
DNS record ttl, values in 0-86400 (optional)
ptr
: bool
When set to true, also create PTR DNS record (optional)
Operation
An Operation resource. For more information, see Operation.
id
: string
ID of the operation.
description
: string
Description of the operation. 0-256 characters long.
createdAt
: google.protobuf.Timestamp
Creation timestamp.
createdBy
: string
ID of the user or service account who initiated the operation.
modifiedAt
: google.protobuf.Timestamp
The time when the Operation resource was last modified.
done
: bool
If the value is false
, it means the operation is still in progress.
If true
, the operation is completed, and either error
or response
is available.
metadata
: google.protobuf.Any
Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.
One of result
The operation result.
If done == false
and there was no failure detected, neither error
nor response
is set.
If done == false
and there was a failure detected, error
is set.
If done == true
, exactly one of error
or response
is set.
error
: google.rpc.StatusThe error result of the operation in case of failure or cancellation.
response
: google.protobuf.AnyThe normal response of the operation in case of success.
If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any.