gcloud alpha compute advice capacity

NAME
gcloud alpha compute advice capacity - get capacity advice for Compute Engine resources
SYNOPSIS
gcloud alpha compute advice capacity --provisioning-model=PROVISIONING_MODEL --size=SIZE --target-distribution-shape=TARGET_DISTRIBUTION_SHAPE (--instance-selection=INSTANCE_SELECTION --instance-selection-machine-types=[MACHINE_TYPE,…]) [--max-run-duration=MAX_RUN_DURATION] [--region=REGION] [--zones=[ZONE,…]] [GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) Get capacity advice for Compute Engine resources.

This command helps you view future resource availability for a specific number of VM instances, machine type, provisioning model, and zone. After you confirm resource availability, you can specify those configurations when you create VM instances. This action improves the success rate of your VM instance creation request.

EXAMPLES
To check the availability of 100 n2-standard-32 Spot VMs in any single zone in the us-central1 region, run the following command:
gcloud alpha compute advice capacity --region="us-central1" --provisioning-model="SPOT" --size=100 --instance-selection-machine-types="n2-standard-32" --target-distribution-shape="any-single-zone"

To check the availability of 50 Spot VMs, allowing either e2-standard-8 or e2-standard-16 machine types, distributed across us-central1-a and us-central1-b, run the following command:

gcloud alpha compute advice capacity --region="us-central1" --provisioning-model="SPOT" --size=50 --instance-selection="name=my-selection,machine-type=e2-standard-8,machine-type=e2-standard-16" --target-distribution-shape="any" --zones="us-central1-a,us-central1-b"

To check the availability of 10 ct5lp-hightpu-4t Flex-start VMs that will run for 1 day in any single zone in the us-central1 region, run the following command:

gcloud alpha compute advice capacity --region="us-central1" --provisioning-model="FLEX_START" --max-run-duration=1d --size=10 --instance-selection-machine-types="ct5lp-hightpu-4t" --target-distribution-shape="any-single-zone"
REQUIRED FLAGS
--provisioning-model=PROVISIONING_MODEL
Specifies the provisioning model. PROVISIONING_MODEL must be one of:
FLEX_START
Compute Engine will attempt to allocate the requested capacity within a specific time frame. If it succeeds, the VMs will start running and keep running for a maximum of 7 days.
SPOT
Compute Engine may preempt a Spot VM whenever it needs capacity. Because Spot VMs don't have a guaranteed runtime, they come at a discounted price.
--size=SIZE
The total number of VMs being requested in the capacity query.
--target-distribution-shape=TARGET_DISTRIBUTION_SHAPE
Defines the distribution requirement for the requested VMs. TARGET_DISTRIBUTION_SHAPE must be one of:
ANY
When you specify ANY for VM instance creation across multiple zones, you specify that you want to create your VM instances in one or more zones based on resource availability, and to use any unused, matching reservation in your project. Use ANY for batch workloads that don't require high availability.
ANY_SINGLE_ZONE
When you specify ANY_SINGLE_ZONE for VM instance creation, you specify that you want to create all VM instances in a single available zone. Compute Engine selects this zone based on resource availability and on any unused, matching reservation in your project. However, zonal resource availability constraints might prevent Compute Engine from creating all your requested VM instances. Use ANY_SINGLE_ZONE when the VM instances in your workloads need to frequently communicate among each other.
Specifies the machine types for which advice is being sought.

At least one of these must be specified:

--instance-selection=INSTANCE_SELECTION
Named selection of machine types. For example, --instance-selection="name=instance-selection-1,machine-type=e2-standard-8,machine-type=t2d-standard-8".
--instance-selection-machine-types=[MACHINE_TYPE,…]
Specifies a comma-separated list of preferred machine types for creating virtual machines.
OPTIONAL FLAGS
--max-run-duration=MAX_RUN_DURATION
Maximum duration for which the requested VMs can run. This flag must be used when the requested provisioning model is FLEX_START.

The duration is formatted as the number of days, hours, minutes, and seconds followed by d, h, m, and s respectively. For example, specify 30m for a duration of 30 minutes or specify 1d2h3m4s for a duration of 1 day, 2 hours, 3 minutes, and 4 seconds.

--region=REGION
Region of the resources to get advice on. If not specified, you might be prompted to select a region (interactive mode only).

To avoid prompting when this flag is omitted, you can set the compute/region property:

gcloud config set compute/region REGION

A list of regions can be fetched by running:

gcloud compute regions list

To unset the property, run:

gcloud config unset compute/region

Alternatively, the region can be stored in the environment variable CLOUDSDK_COMPUTE_REGION.

--zones=[ZONE,…]
A comma-separated list of zones to query within the specified region, for example, us-central1-a,us-central1-b. If you omit this flag, then you view availability for your requested capacity across all zones in the region.
GCLOUD WIDE FLAGS
These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.

Run $ gcloud help for details.

NOTES
This command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist.