Compute Engine provides resource-based committed use discounts (CUDs) for your predictable workloads to help you cut costs on resources that you need. You can purchase and renew resource-based committed use contracts or commitments in return for heavily discounted prices for VM usage.
This document provides information about resource-based commitments, how to purchase them, and the resulting CUDs.
To learn about spend-based CUDs for Compute Engine, see Compute flexible CUDs.
Resource-based commitments are ideal for predictable and steady state usage. These commitments require no upfront costs. Compute Engine lets you purchase the following categories of resource-based commitments:
- Hardware commitments: You can purchase hardware commitments for a specific machine series and commit to resources available for that machine series, such as vCPUs, memory, GPUs, Local SSD disks, and sole tenant nodes. For more information, see Purchase commitments without attached reservations and Purchase commitments with attached reservations.
- Software license commitments: You can purchase license commitments for applicable premium operating system (OS) licenses. For more information, see Purchase commitments for licenses.
Commitments for hardware resources are separate from commitments for licenses. You can purchase both categories of commitments for a VM instance, but you cannot purchase a single commitment that covers both hardware resources and licenses.
Before you begin
-
If you haven't already, then set up authentication.
Authentication is
the process by which your identity is verified for access to Google Cloud services and APIs.
To run code or samples from a local development environment, you can authenticate to
Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI, then initialize it by running the following command:
gcloud init
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
-
How committed use discounts work
When you purchase a committed use contract, you purchase Compute Engine resources—such as vCPUs, memory, GPUs, Local SSD disks, and sole-tenant nodes—at a discounted price in return for committing to paying for those resources for 1 year or 3 years. The discount is up to 55% for most resources like machine types or GPUs. The discount is up to 70% for memory-optimized machine types. For committed use prices for different machine types, see VM instances pricing.
During your commitment's term, you automatically start receiving CUDs on eligible resource usage in your project that matches the resource types, machine type, and region specified in your commitment. You continue to receive these CUDs for your eligible resource usage until your commitment expires.
Compute Engine maintains a lien on your project for each region in your project where you purchase a commitment. When you purchase a new commitment for any region in your project, Compute Engine associates the lien for that region with the newly created commitment.
You can't cancel a commitment after you purchase it. Your commitment expires at the end of its specified term duration of 1 or 3 years. However, you can enable auto-renewal on your commitment to ensure that it automatically renews for a new term.
Commitment status
Your commitment can have one of the following statuses:
CREATING
: the commitment is being created.NOT_YET_ACTIVE
orPENDING
: the commitment has been created but is not yet active. Compute Engine creates your commitments with this status.- If you're using the Google Cloud CLI or the REST API to purchase your
commitment, then this status value shows as
NOT_YET_ACTIVE
. - If you're using the Google Cloud console to purchase your commitment, then
this status value shows as
PENDING
.
- If you're using the Google Cloud CLI or the REST API to purchase your
commitment, then this status value shows as
ACTIVE
: the commitment is active.EXPIRED
: the commitment has expired. Compute Engine reserves the right to remove expired commitments that are older than 210 days from the expiration date.CANCELED
: Compute Engine canceled the commitment. Compute Engine changes the status of your commitments toCANCELED
when you combine them to create a new merged commitment.
Between the time of your commitment purchase and its activation time, the
status of your commitment remains as NOT_YET_ACTIVE
(or as PENDING
on the
Google Cloud console). After activation, the status of your commitment changes to
ACTIVE
.
For example, suppose you purchase your commitment on January 20th at 10:00 PM
US and Canadian Pacific Time (UTC-8 or UTC-7). Compute Engine creates your
commitment immediately with its status as NOT_YET_ACTIVE
. However, your
commitment becomes ACTIVE
only on January 21st at 12:00 AM US
and Canadian Pacific Time (UTC-8 or UTC-7).
Hardware commitments
Hardware commitments apply only to the specific region and machine family series for which you purchase. In return, you receive discounts on the aggregate prices of all the eligible hardware resources for that machine series within that region. These hardware resources include vCPUs, memory, GPUs, and Local SSD disks.
Purchasing a commitment doesn't affect your VM configurations. Your CUDs apply to the aggregate number of vCPUs, memory, GPUs, and Local SSD disks of a specific machine series within a region. Consequently, the CUDs that you receive for a commitment are not affected by changes to your VM's machine setup, as long as the resources are covered by that commitment.
When you purchase a commitment for a specific machine series, you are eligible for CUDs on all VM machine types regardless of the VM size or tenancy model, including all predefined and custom machine types and sole-tenant nodes. For more information about the eligible resource types for each machine series, see Hardware commitment types.
Efficient usage of your commitments
If you have just a few projects, you can purchase commitments just for the specific resources you plan to use. For example, if you purchase a commitment for 8 cores, and you run 24 cores during the month, you will receive committed use discounts for 8 cores. The other 16 cores will be billed at standard, non-committed use rates. Keep in mind that after you purchase a set amount of commitments, you're billed for those commitments monthly, even if you don't use them. For example, if you purchase commitments for 8 cores, you're billed the committed use rates for those 8 cores for the whole month, even if you might have only run these cores for a part of the month. It is to your advantage to purchase commitments only in increments you know you will use.
Commitments can't be stacked for burst scenarios. For example, if you purchased 10 cores for a month and then ran 20 cores for half the month, your commitments won't apply for the full 20 cores just because their usage was across only half the month.
Usage overage
Any hourly resource usage that is not covered by your commitments is
charged based on the on-demand rates and might be eligible for applicable
sustained use discounts (SUDs).
For example, consider a commitment for 2 vCPUs and 8 GB memory that belong
to the N2 machine series. Suppose that you use this commitment to purchase
and run an n2-standard-2
(2 vCPUs and 8 GB memory) VM for a portion of
the month and then run an n2-standard-8
(8 vCPUs and 32 GB memory) VM
for the remainder of the same month. In this scenario, Compute Engine
combines the usage across both VMs and automatically applies the applicable SUDs
to any resource usage that isn't covered by your commitment.
Combine reservations with commitments
A commitment provides a 1- or 3-year discounted price agreement, but it does not reserve capacity in a specific zone. A reservation ensures that capacity is held in a specific zone even if the reserved VMs are not running. To get zonal resources at discounted prices and also ensure that capacity is reserved for them, you must both purchase commitments and create reservations for those zonal resources.
You can also attach reservations to your resource-based commitments to ensure that the reservations are specific to those commitments. When you commit to GPU or Local SSD resources, you must also reserve those resources and attach those reservations to your commitment.
For more information, see Combine reservations with committed use discounts.
Share committed use discounts across projects
By default, committed use discounts apply at the project level and you receive the applicable committed use discounts only for the project in which you purchase the commitment. If you move the project for which you purchased your commitment to a different Cloud Billing account, then you continue to receive the applicable committed use discounts for that project under the new Cloud Billing account.
However, Compute Engine lets you share discounts for hardware commitments across multiple projects that share the same Cloud Billing account. Sharing your committed use discounts for hardware commitments across all your projects reduces the overhead of managing discounts on a per-project basis, and maximizes your savings by pooling all your discounts across your projects' resource usage.
If you have multiple projects that share the same Cloud Billing account, you can enable committed use discount sharing so all of your projects within that Cloud Billing account share all of your committed use discount contracts.
For example, you purchase two commitments for 80 cores each (a total of 160 cores) and you run 200 cores during the month across different projects in your Cloud Billing account. If you've enabled committed use discount sharing for your Cloud Billing account, then you receive the applicable committed use discounts for 160 of those 200 cores that are used across the projects in that Cloud Billing account. The additional 40 cores are billed at on-demand, non-committed use rates. After you purchase your commitments, you're billed for your committed resources monthly, throughout the commitment time period, even if you don't use the resources. See Understand discount sharing for cost-saving utilization recommendations.
Committed use discounts are subject to Google Cloud commitment-based pricing and billing. By purchasing a committed use discount, you agree to these terms.
Use attribution to allocate discounts
Attribution refers to how your committed use discounts are allocated across your projects. These allocations are reflected in Cloud Billing cost management interfaces, such as the usage cost export or the Google Cloud console.
Attribution applies only when discount sharing is enabled. You can choose the type of attribution you want to use before you turn on discount sharing, and then activate the attribution configuration when you enable discount sharing.
Compute Engine commitments use proportional attribution by default. Proportional attribution commitments are applied to the projects according to the amount of the total eligible usage consumed by each project. For example, if project A consumed $75 worth of usage and project B consumed $25, project A would be covered by up to 75% of available credit and project B would be covered by up to 25%.
Alternatively, you can choose prioritized attribution for your Compute Engine commitments based on the usage you specify. Any remaining unprioritized commitments are applied proportionally to the eligible usage in your remaining projects. The total amount of the allotments cannot exceed the commitment amount purchased.
To choose proportional or prioritized attribution for your Compute Engine commitments, see choose attribution for resource-based commitments.
Specifications
You can only purchase resource-based commitments for resources in a specific region if you have quota available in that region for both of the following:
- Commitments
- Committed resources (with the exception of memory)
For more information, see Quotas for commitments and committed resources.
Commitments must be purchased on a per-region basis.
To use the gcloud CLI to manage commitments, you must be running
gcloud
version 147.0.0 or later. To update the gcloud CLI to the latest version:gcloud components update
To check the version of the gcloud CLI you are running:
gcloud version
Restrictions
The following restrictions apply to resource-based CUDs:
- Projects that are in the free tier period with free tier credit and projects that don't have any payment history don't qualify for committed use discounts.
- You can purchase commitments only on a per-region basis.
You can't change the project for which you purchase a commitment. If you want to share the discount with multiple projects, enable discount sharing.
For commitments shared across projects under one Cloud Billing account: If any part of the commitment is unutilized, the remaining commitment charge remains in the project that purchased that portion of the commitment.
Committed use discounts don't apply to preemptible VM instances, N1 shared-core machine types, or extended memory.
If you use your Compute Engine reservations with Dataflow or Dataproc Serverless, then those reserved resources aren't eligible for Compute Engine CUDs.
For machine types that support per VM Tier_1 networking performance, the higher bandwidth SKUs are excluded from CUDs.
f1-micro
andg1-small
shared-core machines are not eligible for CUDs.For committed use discounted pricing for GPUs and Local SSD disks, you must reserve your resources and attach those reservations to your commitment.
If a reservation is attached to a committed use discount, the reservation can't be deleted for the duration of the commitment.
Pricing
You're billed monthly for your commitment and must pay your monthly commitment fee even if you don't use all of your committed resources. Your commitment fee is the sum of the discounted prices of all your committed resources. Compute Engine calculates the discounted price of each resource by using its prevailing on-demand price on the day your commitment becomes active. Your monthly commitment fee and the discounted prices for your resources stay the same until the end of your commitment term, even if the on-demand prices change.
If you use your commitments to run custom machine types, then Compute Engine charges a 5% premium over the commitment prices. Compute Engine charges this premium for the portion and duration of your commitment that you run these custom machine type VMs.
The discounted pricing (also referred to as CUD pricing) for VM instances, with or without GPUs and Local SSD disks, differs depending on the region. For current rates, see VM instance pricing.
If you move the project for which you purchased commitments to a different Cloud Billing account, then you continue to receive committed use discounts for that project under the new Cloud Billing account. Learn about changing the Cloud Billing account for a project.
Hardware commitment types
You can purchase commitments for the following resources.
Commitment types | Resources for which you can purchase discounts | Applicable to the following resource types |
---|---|---|
General purpose E2 commitments |
|
All E2 machine types |
General purpose N2 commitments |
|
|
General purpose N2D commitments |
|
|
General purpose N4 commitments |
|
|
General purpose C3 commitments |
|
|
General purpose C3D commitments |
|
|
General purpose C4 commitments |
|
|
General purpose C4A commitments |
|
|
General purpose Tau T2D commitments |
|
Standard Tau T2D machine types |
General purpose N1 commitments |
|
|
Storage-optimized Z3 commitments |
|
|
Compute-optimized H3 commitments |
|
|
Compute-optimized C2 commitments |
|
|
Compute-optimized C2D commitments |
|
All C2D machine types |
Memory-optimized M1/M2 commitments |
|
|
Memory-optimized M3 commitments |
|
All M3 machine types |
Accelerator-optimized A2 commitments |
|
|
Accelerator-optimized A3 commitments |
|
|
Accelerator-optimized G2 commitments |
|
|
You can't purchase commitments for f1-micro
, or g1-small
machine types or
for the sole-tenant premium charge.
Commitments for Compute Engine machine types
Google Cloud offers resource-based commitments for hardware resources of several Compute Engine machine family series. Purchase the appropriate commitment type for the machine types you plan to use.
General-purpose machine types
CUDs for general-purpose machine types are applied to resources in the following order:
- N4, N2, N2D, E2, or N1 custom machine types, depending on which commitment you purchase
- Sole-tenant nodes
- E2, N2, N2D, N4, C4, C4A, C3, C3D, Tau T2D, or N1 predefined machine types, depending on which commitment you purchase.
When you purchase commitments for general-purpose machine types, you pick which machine series the commitment applies to. For example, if you purchase general-purpose E2 commitments, they apply to only E2 machine types. Similarly, if you purchase general-purpose N2, N2D, N4, C4, C4A, C3, C3D, Tau T2D, or N1 commitments, the commitments never overlap.
For example, assume you have a region with the following mix:
- 10 N2 custom machine type vCPUs
- 30 GB of custom machine type memory
- 2
n2-standard-4
predefined machine types
You purchase N2 commitments for 15 vCPUs and 13.5 GB of memory for committed use. The CUDs would be applied first to the N2 custom machine types, and any remaining discounts would be applied to the N2 predefined machine types. In this case, all 10 vCPUs of the N2 custom machine types would be charged at committed use prices, and 13.5 GB of custom machine type memory would be charged at committed use prices.
Finally, the remaining 5 vCPUs of committed use would apply to 5 random vCPUs
across the two n2-standard-4 machine
types. Any resource usage that isn't
covered by your commitments might qualify for applicable SUDs.
Additionally, if you use your commitments to run custom machine types, then Compute Engine charges a 5% premium over the commitment prices. Compute Engine charges this premium for the portion and duration of your commitment that you run these custom machine type VMs.
Commitments are aggregated by machine series. If you are unsure of how many commitments to purchase, you might want to purchase a smaller number of commitments, then add more as you need them. For example, you can purchase multiple contracts for 10 vCPUs and zero memory, then purchase separate contracts for additional memory.
To purchase a commitment for general-purpose machine types, see Purchase commitments without attached reservations and Purchase commitments with attached reservations.
Memory-optimized machine types
CUDs for memory-optimized machine types are available at two levels. One level applies to both M1 and M2 machine types. The other level applies to only M3 machine types. You cannot use the same commitment for all memory-optimized machine types.
The Memory Optimized Upgrade Premium Core and RAM SKUs, which are specific to M2 machine types, are not eligible for CUDs. The prices for these SKUs are incorporated into the price rates that are documented on the VM instance pricing page and in the pricing calculator.
If you intend to use memory-optimized machine types, purchase memory-optimized commitments. To purchase a commitment for memory-optimized machine types, see Purchase commitments without attached reservations.
Storage-optimized machine types
To purchase commitments for storage-optimized Z3 machine types, see Purchase commitments without attached reservations and Purchase commitments with attached reservations.
Compute-optimized machine types
To purchase commitments for compute-optimized machine types, see one of the following:
- For C2 and C2D compute-optimized machine types, see Purchase commitments without attached reservations.
- For H3 compute-optimized machine types, see Purchase commitments with attached reservations.
Accelerator-optimized machine types
Accelerator-optimized VMs have a specific model and number of NVIDIA GPUs attached. When you purchase commitments for these machine types, you must also reserve your committed GPUs and attach those reservations to your commitments. To purchase a commitment for A3, A2, or G2 machine types, see Purchase commitments with attached reservations.
Commitments for GPUs and Local SSD disk resources
To purchase commitments for GPUs, Local SSD disks, or both you must also reserve the resources and attach the reservations to your commitment. Reserving these resources is required to ensure that the resources are always available for you (whether you use them or not). There are no additional charges for reserving the resources.
You must purchase commitments by specific GPU types. For example, you can purchase GPUs for either NVIDIA P100s or NVIDIA V100s, but you can't purchase commitments for NVIDIA P100 GPUs and apply them to other GPU types.
To purchase a commitment for GPUs, Local SSD disks, or both, see Purchase commitments with attached reservations in this document.
To learn more about commitments with attached reservations, see Attach reservations to resource-based commitments.
Quotas for commitments and committed resources
You can only purchase resource-based commitments for resources in a specific region if you have quota available in that region for both of the following:
- Commitments
- Committed resources (with the exception of memory)
Specifically, if you want to purchase commitments for any vCPUs, GPUs, or Local SSD disks, then you need to have quota available both for commitments and for those specific committed SKUs in the region where you want to purchase the commitment. There is no quota on memory, so you don't need to have separate quota for committed memory to purchase a commitments for memory.
For example, to purchase 5 commitments that cover 32 vCPUs of general-purpose
N1 machine type, 16 GB memory, 4 NVIDIA P4 GPUs, and 2 Local SSD disks in
us-central1
region, you must have quota for each of the following:
- Five commitments in
us-central1
- 32 committed N1 vCPUs in
us-central1
- Four committed NVIDIA P4 GPUs in
us-central1
- 750 GB (or 2 Local SSD disks) of committed Local SSD disk space in
us-central1
Quota limits
By default, Compute Engine offers a specific amount of commitment quota for each type of committed resource. These quota limits determine the number of commitments you can purchase and the amount of resources you can commit to. To learn how to view the current quota limits and quota usage values for your commitments and committed resources, see View quotas in the Google Cloud console.
If you consistently pay for a very high amount of committed vCPUs for your projects across different regions, then you might be eligible for unlimited quota on your committed vCPUs for all machine types (except for memory-optimized machine types) in all regions.
If you use up all your commitment quota, you won't be able to purchase new commitments. Likewise, if you exhaust your committed resource quota, then you won't be able to purchase a new commitment for that resource even if you have commitment quota available. For example, if you used up all of your commitment quota, then the server returns the following error when you make a commitment purchase request:
"Quota 'COMMITMENTS' exceeded. Limit: 0.0"
Increase quota limits
If you don't have enough quota for your commitments or your committed resources, you can always request for a quota increase from the Quotas page. You can request for quota increases at any time. To learn how to submit a request to increase quota limits for your resources, see Request a higher quota limit.
For example, consider a scenario where you purchased two commitments for a
total of four NVIDIA V100
GPUs in us-central1
and met your quota limits.
region. Suppose you want to purchase two new commitments for two
NVIDIA V100 GPUs
each, in the same region, you must do the following:
- Submit a new quota request to increase your
Committed NVIDIA V100 GPUs
quota inus-central1
to the new maximum number (eight) that you want. Submit a new quota request to increase your
Commitments
quota inus-central1
to match the new maximum number (four) that you want.Wait for your requests to be approved and closed. After your requests are approved, your commitment and committed GPU quotas in
us-central1
increase to match your new needs. You can then purchase your new commitments.
If you place a request for an increase in quota limit for a resource that already has unlimited quota by default, then the quota value for that resource remains unlimited and you are notified that your requested limit is below the approved limit.
Set a cap for quota limits
You can set a cap on the quota value for your committed resources by creating a consumer quota override. For resources that have unlimited quota by default, creating a consumer quota override decreases the quota value. To return the default quota to its unlimited value, you must remove the consumer override that was set for your committed SKUs. For more information, see Creating a consumer quota override and Deleting a consumer quota override.
To learn more about how to manage quotas for your resources, see View and manage quotas.
Purchase commitments without attached reservations
You can purchase commitments for vCPUs, memory, or both without attaching any reservations for those resources. You can purchase these commitments using the Google Cloud console, the gcloud CLI, or the API.
To learn more about commitments with attached reservations, see Attach reservations to resource-based commitments
To purchase commitments for GPUs, Local SSDs disks, or both, see Purchase commitments with attached reservations.
By default, project owners have permission to purchase committed use discount contracts. However, it's possible for owners to create custom roles that include or exclude certain users. Read about access control to ensure you have permission to purchase a committed use discount contract.
After you purchase a commitment, your commitment becomes active on the following day at 12 AM US and Canadian Pacific Time (UTC-8, or UTC-7 during daylight saving time). Compute Engine maintains a lien on your project for each region in your project where you purchase a commitment. When you purchase a new commitment for any region in your project, Compute Engine associates the lien for that region with the newly created commitment.
Between the time of your commitment purchase and its activation time, the
status of your commitment remains as NOT_YET_ACTIVE
(or as PENDING
on the
Google Cloud console). After activation, the status of your commitment changes to
ACTIVE
.
For example, suppose you purchase your commitment on January 20th at 10:00 PM
US and Canadian Pacific Time (UTC-8 or UTC-7). Compute Engine creates your
commitment immediately with its status as NOT_YET_ACTIVE
. However, your
commitment becomes ACTIVE
only on January 21st at 12:00 AM US
and Canadian Pacific Time (UTC-8 or UTC-7).
The discounts are automatically applied to applicable instances in the region you specified, and to the projects in which those discounts are purchased.
Console
Before you purchase a commitment using the Google Cloud console, select the project that you want to use to purchase the commitment. If CUD sharing is enabled for a Cloud Billing account, you can purchase the commitment using any project from that Cloud Billing account. After you select the project, do the following:
In the Google Cloud console, go to the Committed use discounts page.
To purchase a commitment, click
Purchase commitment. The Purchase a committed use discount page opens and displays the Hardware tab.In the Name field, enter a name for your commitment.
In the Region field, select the region where you want to commit to Compute Engine resources.
In the Commitment type field, select the machine family series for your committed resources. For vCPUs, memory, or both, you can choose from the following commitment types:
- Accelerator-optimized A2 for A2 machine type resources
- Accelerator-optimized A3 for A3 Edge and High machine type resources
- Accelerator-optimized A3 Mega for A3 Mega machine type resources
- Compute-optimized C2 for C2 machine type resources
- Compute-optimized C2D for C2D machine type resources
- Compute-optimized H3 for H3 machine type resources
- General-Purpose C3 for C3 machine type resources
- General-Purpose C3D for C3D machine type resources
- General-Purpose C4 for C4 machine type resources
- General-Purpose C4A for C4A machine type resources
- General-Purpose E2 for E2 machine type resources
- General-Purpose N1 for N1 machine type resources
- General-Purpose N2 for N2 machine type resources
- General-Purpose N2D for N2D machine resources
- General-Purpose N4 for N4 machine type resources
- General-Purpose T2D for Tau T2D machine type resources
- Graphics-optimized G2 for G2 machine type resources
- Memory-optimized M1/M2 for M1 or M2 machine type resources
- Memory-optimized M3 forM3 machine type resources
- Storage-optimized Z3 for Z3 machine type resources
In the Duration section, do the following:
- To specify your commitment's plan, select either 1 year or 3 years. This setting determines the preset term length of your commitment.
Optional. To specify a custom term length for your commitment, click the Extend end date toggle and then, in the Date field, specify the custom end date that you want. For more information, see Extend the term length of commitments.
In the Cores field, enter the number of vCPUs that you want to commit to.
In the Memory field, enter the amount, in GB, of memory that you want to commit to.
To finish purchasing your commitment, do the following:
- Click Purchase.
- In the Purchase a committed use discount dialog, if you agree with the service specific terms, click Purchase again.
gcloud
Using the gcloud CLI, run the
gcloud compute commitments create
command:
gcloud compute commitments create COMMITMENT_NAME \ --region REGION \ --project PROJECT_ID \ --resources vcpu=NUMBER_VCPUS,memory=MEMORY \ --plan DURATION \ --type COMMITMENT_TYPE
Replace the following:
COMMITMENT_NAME
: the name you want to identify this commitment with.REGION
: the region this commitment applies to. Each region has different commitment prices. For current prices, see the price sheet.PROJECT_ID
: the project ID of the project for which you want to create the commitment.NUMBER_VCPUS
: the number of vCPUs you are willing to purchase commitments for. The number of vCPUs must be an integer of 0 or more and can be even or odd.MEMORY
: the amount, in MB or GB, of memory you are willing to purchase commitments for. For example,1000MB
. If the units are not specified, the default unit used is GB. Memory can be purchased in increments of 0.25 GB.DURATION
: the term of the commitment, either12-month
or36-month
.COMMITMENT_TYPE
: one of:accelerator-optimized
for A2 machine type resourcesaccelerator-optimized-a3
for A3 Edge and High machine type resourcesaccelerator-optimized-a3-mega
for A3 Mega machine type resourcescompute-optimized
for C2 machine type resourcescompute-optimized-c2d
for C2D machine type resourcescompute-optimized-c3
for C3 machine type resourcescompute-optimized-c3d
for C3D machine type resourcescompute-optimized-h3
for H3 machine type resourcesgeneral-purpose
for N1 machine type resourcesgeneral-purpose-c4
for C4 machine type resourcesgeneral-purpose-c4a
for C4A machine type resourcesgeneral-purpose-e2
for E2 machine type resourcesgeneral-purpose-n2
for N2 machine type resourcesgeneral-purpose-n2d
for N2D machine resourcesgeneral-purpose-n4
for N4 machine type resourcesgeneral-purpose-t2d
for Tau T2D machine type resourcesgraphics-optimized
for G2 machine type resourcesmemory-optimized
for M1 or M2 machine type resourcesmemory-optimized-m3
for M3 machine type resourcesstorage-optimized-z3
for Z3 machine type resources
If you don't specify the
--type
flag, the default value used isgeneral-purpose
.
Examples
To create a general-purpose commitment for N1 machine types, you might use the following example:
gcloud compute commitments create example-commitment --region us-central1 \ --resources vcpu=5,memory=33280MB --plan 12-month \ --project=myproject
To create a compute-optimized commitment, use the
gcloud compute commitments create
command, which purchases a 1 year commitment for a compute-optimized machine type:gcloud compute commitments create example-compute-optimized-commitment \ --region us-central1 --resources vcpu=2,memory=3814GB --plan 12-month \ --type compute-optimized --project=myproject
To create a memory-optimized commitment:
gcloud compute commitments create example-memory-optimized-commitment \ --region us-central1 --resources vcpu=96,memory=1434MB \ --plan 12-month --type memory-optimized \ --project=myproject
To create an accelerator-optimized commitment, you must purchase your commitment with a supporting attached reservation by using the
gcloud compute commitments create
command. You must also specify the total number of resources (including GPUs) that you need.When creating GPU commitments, you need to specify the
--accelerator
and--resources-accelerator
flags. The--accelerator
flag specifies the number of GPUs that are attached to each VM. The--resources-accelerator
flag specifies the total number of GPUs in the commitment.For example, the following commitment includes 96 vCPUs, 680 GB memory, 8 GPUs, and a reservation for those GPUs to be used in 2 VMs in
us-central1-a
.gcloud compute commitments create example-accelerator-optimized-commitment \ --region=us-central1 \ --project=myproject \ --resources=vcpu=96,memory=680GB \ --resources-accelerator=count=8,type=nvidia-tesla-a100 \ --plan 12-month \ --type accelerator-optimized \ --reservation=reservation-01 \ --reservation-zone=us-central1-a \ --machine-type=a2-highgpu-4g \ --accelerator=count=4,type=nvidia-tesla-a100 \ --vm-count=2
To create a commitment for GPUs, Local SSD disks, or both, you must purchase your commitment with an attached reservation by using the
gcloud compute commitments create
command.When creating GPU commitments, you need to specify the
--accelerator
and--resources-accelerator
flags. The--accelerator
flag specifies the number of GPUs that are attached to each VM. The--resources-accelerator
flag specifies the total number of GPUs in the commitment.For example, the following commitment includes 4 GPUs and a reservation for those GPUs to be used in 2 instances in
us-central1-a
.gcloud compute commitments create example-reservation-commitment \ --region=us-central1 \ --project=myproject \ --resources=vcpu=96,memory=624GB \ --resources-accelerator=type=nvidia-tesla-v100,count=4 \ --plan 12-month \ --reservation=reservation-01 \ --reservation-zone=us-central1-a \ --machine-type=n1-standard-32 --accelerator=type=nvidia-tesla-v100,count=2 \ --vm-count=2
REST
In the API, make a POST
request to the
regionCommitments.insert
method,
with a request body that contains information about the commitment:
https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/commitments?requestId=OPTIONAL_UNIQUE_ID
The resource body should contain the following:
name
for the name of the commitmentplan
for the term of the commitment, eitherTWELVE_MONTH
orTHIRTY_SIX_MONTH
resources
to specify the amount of memory and vCPU. Memory must be be specified in MB. You must specify bothVCPU
andMEMORY
in theresources
section.type
of commitment, one of the following:ACCELERATOR_OPTIMIZED
for A2 machine type resourcesACCELERATOR_OPTIMIZED_A3
for A3 Edge and High machine type resourcesACCELERATOR_OPTIMIZED_A3_MEGA
for A3 Mega machine type resourcesCOMPUTE_OPTIMIZED
for C2 machine type resourcesCOMPUTE_OPTIMIZED_C2D
for C2D machine type resourcesCOMPUTE_OPTIMIZED_C3
for C3 machine type resourcesCOMPUTE_OPTIMIZED_C3D
for C3D machine type resourcesCOMPUTE_OPTIMIZED_H3
for H3 machine type resourcesGENERAL_PURPOSE
for N1 machine type resourcesGENERAL_PURPOSE_C4
for C4 machine type resourcesGENERAL_PURPOSE_C4A
for C4A machine type resourcesGENERAL_PURPOSE_E2
for E2 machine type resourcesGENERAL_PURPOSE_N2
for N2 machine type resourcesGENERAL_PURPOSE_N2D
for N2D machine resourcesGENERAL_PURPOSE_N4
for N4 machine type resourcesGENERAL_PURPOSE_T2D
for Tau T2D machine type resourcesGRAPHICS_OPTIMIZED
for G2 machine type resourcesMEMORY_OPTIMIZED
for M1 or M2 machine type resourcesMEMORY_OPTIMIZED_M3
for M3 machine type resourcesSTORAGE_OPTIMIZED_Z3
for Z3 machine type resources
For example, the following creates a commitment for 1 year with 5 vCPUs and 18.75 GB of memory:
{
"name": "example-commitment",
"plan": "TWELVE_MONTH",
"type": "GENERAL_PURPOSE",
"resources": [
{
"amount": "5",
"type": "VCPU"
},
{
"amount": "19200",
"type": "MEMORY"
}
]
}
To create a memory-optimized commitment, include the type
property. The
following example shows a purchase of a 1 year
commitment for an m1-megamem-96
machine type:
{
"name": "example-memory-optimized-commitment",
"plan": "TWELVE_MONTH",
"type": "MEMORY_OPTIMIZED",
"resources": [
{
"amount": "96",
"type": "VCPU"
},
{
"amount": "1434",
"type": "MEMORY"
}
]
}```
To create a compute-optimized commitment, include the `type` property. The
following example, purchases a 1 year commitment for a `c2-standard-16`
machine type:
```json
{
"name": "example-compute-optimized-commitment",
"plan": "TWELVE_MONTH",
"type": "COMPUTE_OPTIMIZED",
"resources": [
{
"amount": "16",
"type": "VCPU"
},
{
"amount": "1434",
"type": "MEMORY"
}
]
}
Purchase commitments with attached reservations
When you purchase a new commitment, you can attach reservations to your commitment in either of the following ways:
- Using existing reservations whose properties match with the commitment
- Creating new matching reservations while purchasing of your commitment
After you purchase a commitment, your commitment becomes active on the
following day at 12 AM US and Canadian Pacific Time (UTC-8, or UTC-7 during
daylight saving time).
Between the time of your commitment purchase and its activation time, the
status of your commitment remains as NOT_YET_ACTIVE
(or as PENDING
on the
Google Cloud console). After activation, the status of your commitment changes to
ACTIVE
.
For example, suppose you purchase your commitment on January 20th at 10:00 PM
US and Canadian Pacific Time (UTC-8 or UTC-7). Compute Engine creates your
commitment immediately with its status as NOT_YET_ACTIVE
. However, your
commitment becomes ACTIVE
only on January 21st at 12:00 AM US
and Canadian Pacific Time (UTC-8 or UTC-7).
Requirements
Before you purchase a commitment with attached reservations, review these requirements and make sure that your commitment and reservations meet the following criteria:
- You must purchase the commitment and create the attached reservations in the same project and region.
- You must purchase the commitment and create the attached reservations for resources from the same machine family series.
- You must disable the auto-delete option on the attached reservations.
- If your commitment has GPUs, then the GPU type specified in the reservation and the commitment must match.
- For GPUs and Local SSD disks, the number of reserved resources of each resource type must exactly match with the number of committed resources for that resource type. For example, if you want to purchase a commitment for 4 V100 GPUs, then your commitment's attached reservations must specify a total of 4 V100 GPUs. However, the amount of vCPU and memory that you reserve can be more or less than what you commit to.
- For GPUs, purchase commitments for the specific GPU types that you intend to use. For example, you can purchase commitments for either NVIDIA P100s or NVIDIA V100s, but you cannot use a commitment that was purchased for NVIDIA P100 GPUs to cover NVIDIA V100 GPUs.
If your attached reservation is a shared reservation and you want to receive the applicable CUDs when you consume that reservation outside your commitment's project, then you must do both the following:
- Share your reservations only between projects that belong to the same Cloud Billing account as the commitment.
- Enable CUD sharing for that Cloud Billing account.
Attach existing reservations
You can attach existing reservations while purchasing your commitment by using the Google Cloud console, the Google Cloud CLI, or REST.
Console
Before you purchase a commitment using the Google Cloud console, select the project that you want to use to purchase the commitment. If CUD sharing is enabled for a Cloud Billing account, you can purchase the commitment using any project from that Cloud Billing account. After you select the project, do the following:
In the Google Cloud console, go to the Committed use discounts page.
To purchase a commitment, click
Purchase commitment. The Purchase a committed use discount page opens and displays the Hardware tab.In the Name field, enter a name for your commitment.
In the Region field, select the region where you want to commit to Compute Engine resources.
In the Commitment type field, select the machine family series for your committed resources. The following commitment types provide options for GPUs, Local SSD disks, or both:
- Accelerator-optimized A2 for A2 machine type resources
- Accelerator-optimized A3 for A3 Edge and High machine type resources
- Accelerator-optimized A3 Mega for A3 Mega machine type resources
- Compute-optimized C2 for C2 machine type resources
- Compute-optimized C2D for C2D machine type resources
- General-Purpose C3 for C3 machine type resources
- General-Purpose C3D for C3D machine type resources
- General-Purpose N1 for N1 machine type resources
- General-Purpose N2 for N2 machine type resources
- General-Purpose N2D for N2D machine resources
- Graphics-optimized G2 for G2 machine type resources
- Memory-optimized M3 forM3 machine type resources
- Storage-optimized Z3 for Z3 machine type resources
For Duration, do the following:
- To specify your commitment's plan, select either 1 year or 3 years. This setting determines the preset term length of your commitment.
Optional. To specify a custom term length for your commitment, click the Extend end date toggle and then, in the Date field, specify a custom end date. For more information, see Extend the term length of commitments.
In the Cores field, enter the number of vCPUs that you want to commit to.
In the Memory field, enter the amount, in GB, of memory that you want to commit to.
To commit to GPUs, in the GPUs section, click
Add GPU and then do the following:- In the GPU type field, select the type of GPU.
- In the Number of GPUs field, enter the number of GPUs.
- Optional: If your GPU model supports NVIDIA RTX Virtual Workstations (vWS) for graphics workloads, and you plan to run graphics-intensive workloads, select the Enable Virtual Workstation (NVIDIA GRID) checkbox.
To commit to Local SSD disks, in the Local SSDs section, click
Add SSD and then, in the Number of SSDs field, specify the number of disks.To attach one or more existing reservations to the commitment, in the Reservations field, select Attach existing reservations.
The Google Cloud console displays a list of all the reservations in your project whose region, machine type, and GPU type match with the commitment. Then, do the following:
- Optional. To view reservations with specific properties, in the Filter menu, add or remove filters for the properties that you want.
- Select all the reservations that you want to attach to the commitment.
To finish purchasing your commitment with the attached reservations, do the following:
- Click Purchase.
- In the Purchase a committed use discount dialog, if you agree with the service specific terms, click Purchase again.
gcloud
To purchase a commitment by attaching existing reservations, run the
gcloud compute commitments create
command.
In your command, include the --existing-reservation
flag to specify an
existing reservation that you want to attach to your commitment. Include a
new instance of this flag for every existing reservation that you want to
attach. You can attach any number of existing reservations to your
commitment.
For example, to purchase a commitment by attaching two reservations to it, run the following command:
gcloud compute commitments create COMMITMENT_NAME \ --region=REGION \ --project=PROJECT_ID \ --resources=vcpu=COMMITTED_VCPUS,memory=COMMITTED_MEMORY,local-ssd=COMMITTED_LOCAL_SSD \ --resources-accelerator=count=COMMITTED_ACCELERATOR_COUNT,type=COMMITTED_ACCELERATOR_TYPE \ --plan=DURATION \ --type=COMMITMENT_TYPE \ --custom-end-time=CUSTOM_END_DATE \ --existing-reservation=name='RESERVATION_NAME_1',zone='RESERVATION_ZONE_1' \ --existing-reservation=name='RESERVATION_NAME_2',zone='RESERVATION_ZONE_2'
Replace the following:
COMMITMENT_NAME
: the name of the commitment.REGION
: the region where the commitment is located.PROJECT_ID
: the ID of the project where you want to purchase the commitment with the attached reservations.DURATION
: the term duration of the commitment, either12-month
or36-month
.CUSTOM_END_DATE
: Optional. A custom end date for your term, which must be formatted asYYYY-MM-DD
. For example, to specify a custom end date of April 20, 2024, format it as2024-04-20
.COMMITMENT_TYPE
: the commitment type. The following commitment types provide options for GPUs, Local SSD disks, or both:accelerator-optimized
for A2 machine type resourcesaccelerator-optimized-a3
for A3 Edge and High machine type resourcesaccelerator-optimized-a3-mega
for A3 Mega machine type resourcescompute-optimized
for C2 machine type resourcescompute-optimized-c2d
for C2D machine type resourcescompute-optimized-c3
for C3 machine type resourcescompute-optimized-c3d
for C3D machine type resourcesgeneral-purpose
for N1 machine type resourcesgeneral-purpose-n2
for N2 machine type resourcesgeneral-purpose-n2d
for N2D machine resourcesgraphics-optimized
for G2 machine type resourcesmemory-optimized-m3
for M3 machine type resourcesstorage-optimized-z3
for Z3 machine type resources
COMMITTED_VCPUS
: the number of vCPUs that you want in your commitment. The number must be a positive integer.COMMITTED_MEMORY
: the amount, in MB or GB, of memory that you want in your commitment. For example,10240MB
or10GB
. If you don't specify a unit, Compute Engine uses GB as the unit. You can purchase memory in increments of 0.25 GB.COMMITTED_LOCAL_SSD
: the amount, in GB, of Local SSD space that you want in your commitment. Each Local SSD disk is 375 GB.COMMITTED_ACCELERATOR_COUNT
: the number of GPUs that you want in your commitment.COMMITTED_ACCELERATOR_TYPE
: the GPU type that you want in your commitment.RESERVATION_NAME_1
andRESERVATION_NAME_2
: The names of the existing reservations that you want to attach to the commitment.RESERVATION_ZONE_1
andRESERVATION_ZONE_2
: The zones of the existing reservations that you want to attach to the commitment.
Example: Purchase a commitment by attaching existing reservations
Suppose you have two reservations res-01
and res-02
in the
us-central1-a
and us-central1-b
zones of the project myproject
.
Suppose that these reservations hold a combined capacity for 4 NVIDIA P100
GPUs and 4 Local SSD disks. To purchase a new commitment in the
us-central1
region of this project for these GPUs and Local SSD disks,
and use these existing reservations as attached reservations, run the
following command. Note that the example commitment also contains vCPUs and
memory.
gcloud compute commitments create commitment-01 \ --region=us-central1 \ --project=myproject \ --resources=vcpu=96,memory=624GB,local-ssd=1500 \ --resources-accelerator=type=nvidia-tesla-p100,count=4 \ --plan 12-month \ --existing-reservation=name=res-01,zone=us-central1-a \ --existing-reservation=name=res-02,zone=us-central1-b
REST
To purchase a commitment by attaching existing reservations, make a POST
request to the regionCommitments.insert
method.
In your request, include the existingReservations
field to specify a
comma-separated list of all the existing reservations that you want to
attach to your commitment. You can attach any number of existing
reservations to your commitment.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/commitments { "name": "COMMITMENT_NAME", "plan": "DURATION", "type": COMMITMENT_TYPE, "resources": [ { "amount": "COMMITTED_VCPUS", "type": "VCPU" }, { "amount": "COMMITTED_MEMORY", "type": "MEMORY" }, { "acceleratorType": "COMMITTED_ACCELERATOR_TYPE", "amount": "COMMITTED_ACCELERATOR_COUNT", "type": "ACCELERATOR" } { "amount": "COMMITTED_LOCAL_SSD", "type": "LOCAL_SSD" } ], "customEndTimestamp": "CUSTOM_END_DATETEND_TIMEZ", "existingReservations": "RESERVATION_URLs" }
Replace the following:
COMMITMENT_NAME
: the name of the commitment.REGION
: the region where the commitment is located.PROJECT_ID
: the ID of the project where you want to purchase the commitment with the attached reservations.DURATION
: the term duration of the commitment, eitherTWELVE_MONTH
orTHIRTY_SIX_MONTH
.COMMITMENT_TYPE
: the commitment type. The following commitment types provide options for GPUs, Local SSD disks, or both:ACCELERATOR_OPTIMIZED
for A2 machine type resourcesACCELERATOR_OPTIMIZED_A3
for A3 Edge and High machine type resourcesACCELERATOR_OPTIMIZED_A3_MEGA
for A3 Mega machine type resourcesCOMPUTE_OPTIMIZED
for C2 machine type resourcesCOMPUTE_OPTIMIZED_C2D
for C2D machine type resourcesCOMPUTE_OPTIMIZED_C3
for C3 machine type resourcesCOMPUTE_OPTIMIZED_C3D
for C3D machine type resourcesGENERAL_PURPOSE
for N1 machine type resourcesGENERAL_PURPOSE_N2
for N2 machine type resourcesGENERAL_PURPOSE_N2D
for N2D machine resourcesGRAPHICS_OPTIMIZED
for G2 machine type resourcesMEMORY_OPTIMIZED_M3
for M3 machine type resourcesSTORAGE_OPTIMIZED_Z3
for Z3 machine type resources
COMMITTED_VCPUS
: the number of vCPUs that you want in your commitment. The number must be a positive integer.COMMITTED_MEMORY
: the amount, in MB, of memory that you want in your commitment. For example,10240MB
. You can purchase memory in increments of 256 MB.COMMITTED_LOCAL_SSD
: the amount, in GB, of Local SSD storage that you want in your commitment. Each Local SSD disks is 375 GB.COMMITTED_ACCELERATOR_COUNT
: the number of GPUs that you want in your commitment.COMMITTED_ACCELERATOR_TYPE
: the GPU type that you want in your commitment.CUSTOM_END_DATE
: Optional. A custom end date for your term, which must be formatted asYYYY-MM-DD
. For example, to specify a custom end date of April 20, 2024, format it as2024-04-20
.END_TIME
: 12 AM US and Canadian Pacific Time (UTC-8 or UTC-7), as an offset of Coordinated Universal Time (UTC). Specify this value only if you specified a custom end date for your commitment. Specify one of the following values:- During daylight saving time:
07:00:00
- During other times:
08:00:00
- During daylight saving time:
RESERVATION_URLs
: a comma-separated list of URLs of the existing reservations that you want to attach to the commitment. For example, to attach two reservations,res-1
andres-2
, specify the following:"https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-a/reservations/example-res-1", "https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-c/reservations/example-res-2"
Example: Purchase a commitment by attaching existing reservations
Suppose you have two reservations res-01
and res-02
in the
us-central1-a
and us-central1-b
zones of the project myproject
.
Suppose that these reservations hold a combined capacity for 4 NVIDIA P100
GPUs and 4 Local SSD disks. To purchase a new commitment in the
us-central1
region of this project for these GPUs and Local SSD disks and
to use these existing reservations as attached reservations,
make the following POST
request. Note that the example commitment also
contains vCPUs and memory.
POST https://compute.googleapis.com/compute/v1/projects/my-project/regions/us-central1/commitments { "name": "commitment-01", "plan": "TWELVE_MONTH", "type": "GENERAL_PURPOSE" "resources": [ { "amount": "96", "type": "VCPU" }, { "amount": "638976", "type": "MEMORY" }, { "acceleratorType": "nvidia-tesla-p100", "amount": "4", "type": "ACCELERATOR" }, { "amount": "1536000", "type": "LOCAL_SSD" } ], "existingReservations": [ "https://www.googleapis.com/compute/v1/projects/my-project/zone/us-central1-a/reservations/res-01", "https://www.googleapis.com/compute/v1/projects/my-project/zone/us-central1-b/reservations/res-02" ] }
Create new reservations to attach
You can create your attached reservations while purchasing your commitment by using the Google Cloud console, the Google Cloud CLI, or REST.
Console
Before you purchase a commitment using the Google Cloud console, select the project that you want to use to purchase the commitment. If CUD sharing is enabled for a Cloud Billing account, you can purchase the commitment using any project from that Cloud Billing account. After you select the project, do the following:
In the Google Cloud console, go to the Committed use discounts page.
To purchase a commitment, click
Purchase commitment. The Purchase a committed use discount page opens and displays the Hardware tab.In the Name field, enter a name for your commitment.
In the Region field, select the region where you want to commit to Compute Engine resources.
In the Commitment type field, select the machine family series for your committed resources. The following commitment types provide options for GPUs, Local SSD disks, or both:
- Accelerator-optimized A2 for A2 machine type resources
- Accelerator-optimized A3 for A3 Edge and High machine type resources
- Accelerator-optimized A3 Mega for A3 Mega machine type resources
- Compute-optimized C2 for C2 machine type resources
- Compute-optimized C2D for C2D machine type resources
- General-Purpose C3 for C3 machine type resources
- General-Purpose C3D for C3D machine type resources
- General-Purpose N1 for N1 machine type resources
- General-Purpose N2 for N2 machine type resources
- General-Purpose N2D for N2D machine resources
- Graphics-optimized G2 for G2 machine type resources
- Memory-optimized M3 forM3 machine type resources
- Storage-optimized Z3 for Z3 machine type resources
For Duration, choose either 1 year or 3 years as your commitment's term duration.
In the Cores field, enter the number of vCPUs that you want to commit to.
In the Memory field, enter the amount, in GB, of memory that you want to commit to.
To commit to GPUs, in the GPUs section, click
Add GPU and then do the following:- In the GPU type field, select the type of GPU.
- In the Number of GPUs field, enter the number of GPUs.
- Optional: If your GPU model supports NVIDIA RTX Virtual Workstations (vWS) for graphics workloads, and you plan to run graphics-intensive workloads, select the Enable Virtual Workstation (NVIDIA GRID) checkbox.
To commit to Local SSD disks, in the Local SSDs section, click
Add SSD and then, in the Number of SSDs field, specify the number of disks.To create a new reservation and attach it to the commitment, in the Reservations field, select Create reservations and then do the following. Repeat this step for every new reservation that you want to create and attach.
- Click Add a reservation. The New reservation section appears.
- In the Name field, enter a name for your attached reservation.
- In the Region field, select the same region as your commitment.
- In the Zone field, select the zone where you want to reserve your resources.
In the Share type section, specify how you want to share this reservation in one of the following ways:
- To create a single-project reservation, select Local.
- To create a reservation that is shared with multiple projects, select Shared. Then, to specify the projects to share the this reservation with, click Add projects, and then select the projects that you want from the current project's organization.
In the Use with VM instance field, select how you want VMs to consume your reservation in one of the following ways:
- To allow VMs with matching properties to automatically consume this reservation, click Use reservation automatically (default).
- To consume this reservation's resources only when creating VMs with matching properties that specifically target this reservation by name, click select Select specific reservation.
In the Resource details section, do the following:
- In the Number of VM instances field, enter the number of VM instances that you want to reserve.
In the Machine configuration section, specify the properties of your reserved VMs in one of the following ways:
To specify your the properties of your VMs using an existing instance template, select Use instance template.
In the Instance template field, select an instance template that specifies the same machine family series as your commitment. If you select a regional instance template, the region of that instance template must also match with the region specified in your commitment.
To manually specify the properties of your VMs, select Select machine type and then do the following:
Select the machine family that applies to the machine series that you specified for the commitment:
- General purpose for general-purpose machine series
- Compute optimized for compute-optimized machine series
- Memory optimized for memory-optimized machine series
- GPUs for accelerator-optimized machine series
In the table that has Series column, select the same machine series that you specified for the commitment.
In the Machine type field, specify a predefined or custom machine type in one of the following ways:
- To choose a predefined machine type, select Preset and then select the machine type that you want.
- To choose a custom machine type, select Custom and then specify Cores and Memory that you want.
To specify a minimum CPU platform, GPUs, or both, expand the
CPU Platform and GPU menu and do the following:- Optional: To specify a minimum CPU platform, in the CPU Plaform list, select an option.
Optional: To reserve GPUs, click
Add GPU. Then, in the GPU type and Number of GPUs fields, select the type and number of GPUs for each VM.
To reserve local SSD disks, do the following:
- In the Number of disks field, select the number of local SSD disks that you want for each VM.
- In the Interface type field, select the interface for the local SSD disks.
To finish specifying the properties for this reservation, click Done.
To finish purchasing your commitment with the attached reservations, do the following:
- Click Purchase.
- In the Purchase a committed use discount dialog, if you agree with the service specific terms, click Purchase again.
gcloud
To create your attached reservations while purchasing your commitment, run
the gcloud compute commitments create
command.
Depending on whether you want to attach a single reservation or multiple reservations, run the command in one of the following ways:
To create and attach a single reservation to your commitment, define the properties of the attached reservation by running the following command:
gcloud compute commitments create COMMITMENT_NAME \ --region=REGION \ --project=PROJECT_ID \ --plan DURATION \ --type COMMITMENT_TYPE --resources=vcpu=COMMITTED_VCPUS,memory=COMMITTED_MEMORY,local-ssd=COMMITTED_LOCAL_SSD \ --resources-accelerator=count=COMMITTED_ACCELERATOR_COUNT,type=COMMITTED_ACCELERATOR_TYPE \ --custom-end-time=CUSTOM_END_DATE \ --reservation=RESERVATION_NAME \ --reservation-zone=RESERVATION_ZONE \ --machine-type=RESERVED_MACHINE_TYPE \ --require-specific-reservation=REQUIRE_SPECIFIC_RESERVATION_VALUE \ --vm-count=NUMBER_OF_RESERVED_VMs \ --accelerator=type=RESERVED_ACCELERATOR_TYPE,count=RESERVED_ACCELERATOR_COUNT \ --local-ssd=interface=INTERFACE_1,size=375 \ --local-ssd=interface=INTERFACE_2,size=375 \ --minimum-cpu-platform=MINIMUM_CPU_PLATFORM \ --share-setting=SHARE_SETTING \ --share-with=CONSUMER_PROJECT_ID_1,CONSUMER_PROJECT_ID_2
To create and attach multiple reservations to your commitment, define the reservation's properties using a YAML file and then specify that YAML file in the command that you use to purchase your commitment. Optionally, you can also use this YAML file approach to create and attach a single reservation to your commitment. To create your attached reservations using this approach, do the following:
Create the YAML file in the current directory and specify the configuration that you want for each attached reservation. For example, to specify the configuration of a shared reservation shared with two projects that specifies GPUs, two Local SSD disks, and a minimum CPU platform, include the following text in your YAML file:
- reservation: RESERVATION_NAME reservation_zone: RESERVATION_ZONE require_specific_reservation: REQUIRE_SPECIFIC_RESERVATION_VALUE vm_count: NUMBER_OF_RESERVED_VMs machine_type: RESERVED_MACHINE_TYPE accelerator: - count: RESERVED_ACCELERATOR_COUNT type: RESERVED_ACCELERATOR_TYPE localssd: - interface: INTERFACE_1 size: 375 - interface: INTERFACE_2 size: 375 project: OWNER_PROJECT_ID minimum-cpu-platform: MINIMUM_CPU_PLATFORM share-setting: SHARE_SETTING share-with: - CONSUMER_PROJECT_ID_1 - CONSUMER_PROJECT_ID_2
To specify the configuration for multiple reservations, repeat these properties for each reservation that you want to create. You can attach any number of existing reservations that you want to your commitment.
Run the
gcloud compute commitments create
command and include the--reservation-from-file
flag.gcloud compute commitments create COMMITMENT_NAME \ --region REGION \ --project PROJECT_ID \ --plan DURATION \ --type COMMITMENT_TYPE \ --resources=vcpu=COMMITTED_VCPUS,memory=COMMITTED_MEMORY,local-ssd=COMMITTED_LOCAL_SSD \ --resources-accelerator=count=COMMITTED_ACCELERATOR_COUNT,type=COMMITTED_ACCELERATOR_TYPE \ --reservations-from-file=YAML_FILE
Replace the following with the corresponding properties of the commitment and the attached reservations:
Commitment
COMMITMENT_NAME
: the name of the commitment.REGION
: the region where the commitment is located.PROJECT_ID
: the ID of the project where you want to purchase the commitment with the attached reservations.DURATION
: the term duration of the commitment, either12-month
or36-month
.CUSTOM_END_DATE
: Optional. A custom end date for your term, which must be formatted asYYYY-MM-DD
. For example, to specify a custom end date of April 20, 2024, format it as2024-04-20
.COMMITMENT_TYPE
: the commitment type. The following commitment types provide options for GPUs, Local SSD disks, or both:accelerator-optimized
for A2 machine type resourcesaccelerator-optimized-a3
for A3 Edge and High machine type resourcesaccelerator-optimized-a3-mega
for A3 Mega machine type resourcescompute-optimized
for C2 machine type resourcescompute-optimized-c2d
for C2D machine type resourcescompute-optimized-c3
for C3 machine type resourcescompute-optimized-c3d
for C3D machine type resourcesgeneral-purpose
for N1 machine type resourcesgeneral-purpose-n2
for N2 machine type resourcesgeneral-purpose-n2d
for N2D machine resourcesgraphics-optimized
for G2 machine type resourcesmemory-optimized-m3
for M3 machine type resourcesstorage-optimized-z3
for Z3 machine type resources
COMMITTED_VCPUS
: the number of vCPUs that you want in your commitment. The number must be a positive integer.COMMITTED_MEMORY
: the amount, in MB or GB, of memory that you want in your commitment. For example,10GB
or10240MB
. If you don't specify a unit, Compute Engine uses GB as the unit. You can purchase memory in increments of 0.25 GB.COMMITTED_LOCAL_SSD
: the amount, in GB, of Local SSD storage that you want in your commitment. Each Local SSD disk is 375 GB.COMMITTED_ACCELERATOR_COUNT
: the number of GPUs that you want in your commitment.COMMITTED_ACCELERATOR_TYPE
: the GPU type that you want in your commitment.YAML_FILE
: The path to the YAML file that contains the configuration of the attached reservations.
Attached reservations
RESERVATION_NAME
: the name of the attached reservation.RESERVATION_ZONE
: the zone of the attached reservation.REQUIRE_SPECIFIC_RESERVATION_VALUE
: specifies if the attached reservation is a specifically targeted reservation; eithertrue
orfalse
. For more information about specifically targeted reservations, see How reservations work.NUMBER_OF_RESERVED_VMS
: the number of VMs that you want to reserve in the attached reservation.RESERVED_MACHINE_TYPE
: the machine type that you want for the VMs in your attached reservation.- For predefined machine types, use the format
MACHINE_FAMILY-standard-CPUS
; for example,n2-standard-4
. For custom machine types, use the format
MACHINE_FAMILY-custom-CPUS-MEMORY
; for examplen2-custom-4-5120
. For a full list of restrictions, read the specifications for custom machine types.Replace the following:
MACHINE_FAMILY
: the family of machine types; for example, specifyn2
for N2 VMs.CPUS
: the number of vCPUs.MEMORY
: the total memory for a reserved VM. Memory must be a multiple of 256 MB and must be supplied in MB; for example, to create an N2 VM with 4 vCPUs and 5 GB of memory, which is 5120 MB, usen2-custom-4-5120
.
- For predefined machine types, use the format
RESERVED_ACCELERATOR_COUNT
: the number of GPUs you want to add, per VM, in the attached reservation.RESERVED_ACCELERATOR_TYPE
: the type of accelerator you want to add in the attached reservation.INTERFACE_1
andINTERFACE_2
: the type of interface you want the Local SSD disks for each reserved VM to use. Valid options are:scsi
andnvme
. Each Local SSD disk is 375 GB. Repeat thelocal_ssd
parameter for each Local SSD disk that you want to add. You can specify up to 24 Local SSD disks.OWNER_PROJECT_ID
: the ID of the project where you want to purchase the commitment with the attached reservation. Specify this field if you want to share your attached reservation across multiple consumer projects.MINIMUM_CPU_PLATFORM
: the minimum CPU platform that you want to specify for the attached reservation.SHARE_SETTING
: the type of sharing for the attached reservation. Specify this field with the value asprojects
if you want to share your attached reservation across multiple consumer projects. Exclude this field if you want create a single-project reservation.CONSUMER_PROJECT_ID_1
andCONSUMER_PROJECT_ID_2
: the project IDs of the projects that can share this reservation, for exampleproject-1
andproject-2
. You can include up to 100 consumer projects. These projects must be in the same organization as the owner project. Don't include the ID of the project where you create this reservation, as that project is allowed to consume this reservation by default. Exclude these fields if you want to create a single-project reservation.
Compute Engine creates the commitment and the attached reservations only if there are enough resources of the specified machine type in the target zone, and sufficient quota, at the time of your request. If your purchase was successful, you see a success message similar to the following:
Created[https://www.googleapis.com/compute/v1/projects/your-project/regions/your-region/commitments/your-commitment-name]
Examples for purchasing commitments by creating new reservations to attach
The following example scenarios and commands show how you can purchase a commitment for GPUs, Local SSD disks, or both by creating new reservations to attach to that commitment.
Example 1: Purchase a commitment for GPUs by attaching a single new reservation
Suppose you want to purchase a commitment commitment-01
in the
us-central1
region that includes 4 NVIDIA V100 GPUs. You want to create a
new reservation reservation-01
as the attached reservation for
those GPUs. Suppose you also want to specify Compute Engine to use
those reserved GPUs across 2 n1-standard-32
VMs in the us-central1-a
zone. To purchase this example commitment with its attached reservation, run
the following command:
gcloud compute commitments create commitment-01 \ --region=us-central1 \ --project=myproject \ --resources=vcpu=96,memory=624GB \ --resources-accelerator=type=nvidia-tesla-v100,count=4 \ --plan 12-month \ --reservation=reservation-01 \ --reservation-zone=us-central1-a \ --machine-type=n1-standard-32 \ --accelerator=type=nvidia-tesla-v100,count=2 \ --vm-count=2
Example 2: Purchase a commitment for GPUs without committing to vCPUs or memory
To commit to and reserve GPUs and Local SSD disks without committing to
vCPUs or memory, specify 0
as the value for vCPU and memory quantities.
For example, suppose you want to purchase a commitment commitment-02
for a
single NVIDIA P4 GPU in the us-west2
region. You also want to create a new
reservation as the attached reservation and specify
Compute Engine to use the reserved GPU on an n1-standard-2
VM in the
us-west2-b
zone. To purchase this example commitment with its attached
reservation, run the following command:
gcloud compute commitments create commitment-02 \ --region=us-west2 \ --project=myproject \ --resources=vcpu=0,memory=0 \ --resources-accelerator=type=nvidia-tesla-p4,count=1 \ --plan 12-month \ --reservation=reservation-01 \ --reservation-zone=us-west2-b \ --machine-type=n1-standard-2 \ --accelerator=type=nvidia-tesla-p4,count=1 \ --vm-count=1
Example 3: Purchase a commitment for GPUs and Local SSD disks by attaching multiple new reservations
Suppose you want to purchase a commitment commitment-03
for 1
NVIDIA V100 GPU and 2 Local SSD disks in the us-central1
region. You also
want to create and attach two reservations in the
us-central1-a
zone. In the first reservation, res-01
, you want to
reserve 1 n1-standard-2
VM with 1 GPU. You want to make res-01
a
targeted reservation, which means that you must specifically target that
reservation by name to use its reserved VMs. In the second reservation,
res-02
, you want to reserve 1 n1-standard-8
VM with 2 types of
attached Local SSD disks.
To purchase this example commitment with the attached reservations, first create the YAML file with the properties of both reservations.
- reservation: res-01 reservation_zone: us-central1-a require_specific_reservation: true vm_count: 1 machine_type: n1-standard-2 accelerator: - count: 1 type: nvidia-tesla-v100 - reservation: res-02 reservation_zone: us-central1-a vm_count: 1 machine_type: n1-standard-8 local_ssd: - interface: scsi size: 375 - interface: nvme size: 375
After you create the YAML file, to finish purchasing the commitment with its attached reservations, run the following command. Note that the example commitment also contains vCPU and memory resources.
gcloud compute commitments create commitment-03 \ --region=us-central1 \ --project=myproject \ --resources=vcpu=96,memory=624,local-ssd=750 \ --resources-accelerator=type=nvidia-tesla-v100,count=1 \ --plan 12-month \ --reservations-from-file=YAML_FILE
REST
To create your attached reservations while purchasing your commitment,
make a POST
request to the
regionCommitments.insert
method.
In your request, include the reservations
field to define a list of all
the new reservations that you want to create and attach. You can attach any
number of existing reservations that you want to your commitment.
To create your new reservation by manually specifying all the VM properties, include the
instanceProperties
field and exclude thesourceInstanceTemplate
field.For example, to manually specify the configuration of a shared reservation shared with two projects that specifies GPUs, two Local SSD disks, and a minimum CPU platform, make the following request:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/commitments { "name": "COMMITMENT_NAME", "plan": "DURATION", "type": COMMITMENT_TYPE, "resources": [ { "amount": "COMMITTED_VCPUS", "type": "VCPU" }, { "amount": "COMMITTED_MEMORY", "type": "MEMORY" }, { "acceleratorType": "COMMITTED_ACCELERATOR_TYPE", "amount": "COMMITTED_ACCELERATOR_COUNT", "type": "ACCELERATOR" } { "amount": "COMMITTED_LOCAL_SSD", "type": "LOCAL_SSD" } ], "customEndTimestamp": "CUSTOM_END_DATETEND_TIMEZ", "reservations": [ { "name": "RESERVATION_NAME", "specificReservation": { "count": "NUMBER_OF_RESERVED_VMS", "instanceProperties": { "guestAccelerators": [ { "acceleratorCount": "RESERVED_ACCELERATOR_COUNT", "acceleratorType": "RESERVED_ACCELERATOR_TYPE" } ], "localSsds": [ { "diskSizeGb": "375", "interface": "RESERVED_INTERFACE_1" }, { "diskSizeGb": "375", "interface": "RESERVED_INTERFACE_2" } ], "machineType": "RESERVED_MACHINE_TYPE", "minCpuPlatform": "MINIMUM_CPU_PLATFORM" } }, "specificReservationRequired": REQUIRE_SPECIFIC_RESERVATION_VALUE", "zone": "RESERVED_ZONE", "shareSettings": { "shareType": "SPECIFIC_PROJECTS", "projectMap": { "CONSUMER_PROJECT_ID_1": { "projectId": "CONSUMER_PROJECT_ID_1" }, "CONSUMER_PROJECT_ID_2": { "projectId": "CONSUMER_PROJECT_ID_2" } } } } ] }
To create your new reservation by specifying an instance template, include the
sourceInstanceTemplate
field and exclude theinstanceProperties
field.POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/commitments { "name": "COMMITMENT_NAME", "plan": "DURATION", "type": COMMITMENT_TYPE, "resources": [ { "amount": "COMMITTED_VCPUS", "type": "VCPU" }, { "amount": "COMMITTED_MEMORY", "type": "MEMORY" }, { "acceleratorType": "COMMITTED_ACCELERATOR_TYPE", "amount": "COMMITTED_ACCELERATOR_COUNT", "type": "ACCELERATOR" } { "amount": "COMMITTED_LOCAL_SSD", "type": "LOCAL_SSD" } ], "customEndTimestamp": "CUSTOM_END_DATETEND_TIMEZ", "reservations": [ { "name": "RESERVATION_NAME", "specificReservation": { "count": "NUMBER_OF_RESERVED_VMS", "sourceInstanceTemplate": "projects/PROJECT_ID/LOCATION/instanceTemplates/INSTANCE_TEMPLATE_NAME" }, "specificReservationRequired": REQUIRE_SPECIFIC_RESERVATION_VALUE", "zone": "RESERVED_ZONE", "shareSettings": { "shareType": "SPECIFIC_PROJECTS", "projectMap": { "CONSUMER_PROJECT_ID_1": { "projectId": "CONSUMER_PROJECT_ID_1" }, "CONSUMER_PROJECT_ID_2": { "projectId": "CONSUMER_PROJECT_ID_2" } } } } ] }
Replace the following with the corresponding properties of the commitment and the attached reservations:
Commitment
COMMITMENT_NAME
: the name of the commitment.REGION
: the region where the commitment is located.PROJECT_ID
: the ID of the project where you want to purchase the commitment with the attached reservations.DURATION
: the term duration of the commitment, eitherTWELVE_MONTH
orTHIRTY_SIX_MONTH
.COMMITMENT_TYPE
: the commitment type. The following commitment types provide options for GPUs, Local SSD disks, or both:ACCELERATOR_OPTIMIZED
for A2 machine type resourcesACCELERATOR_OPTIMIZED_A3
for A3 Edge and High machine type resourcesACCELERATOR_OPTIMIZED_A3_MEGA
for A3 Mega machine type resourcesCOMPUTE_OPTIMIZED
for C2 machine type resourcesCOMPUTE_OPTIMIZED_C2D
for C2D machine type resourcesCOMPUTE_OPTIMIZED_C3
for C3 machine type resourcesCOMPUTE_OPTIMIZED_C3D
for C3D machine type resourcesGENERAL_PURPOSE
for N1 machine type resourcesGENERAL_PURPOSE_N2
for N2 machine type resourcesGENERAL_PURPOSE_N2D
for N2D machine resourcesGRAPHICS_OPTIMIZED
for G2 machine type resourcesMEMORY_OPTIMIZED_M3
for M3 machine type resourcesSTORAGE_OPTIMIZED_Z3
for Z3 machine type resources
COMMITTED_VCPUS
: the number of vCPUs that you want in your commitment. The number must be a positive integer.COMMITTED_MEMORY
: the amount, in MB, of memory that you want in your commitment. For example,10240MB
. You can purchase memory in increments of 256 MB.COMMITTED_LOCAL_SSD
: the amount, in GB, of Local SSD storage that you want in your commitment. Each Local SSD disk is 375 GB.COMMITTED_ACCELERATOR_COUNT
: the number of GPUs that you want in your commitment.COMMITTED_ACCELERATOR_TYPE
: the GPU type that you want in your commitment.CUSTOM_END_DATE
: Optional. A custom end date for your term, which must be formatted asYYYY-MM-DD
. For example, to specify a custom end date of April 20, 2024, format it as2024-04-20
.END_TIME
: 12 AM US and Canadian Pacific Time (UTC-8 or UTC-7), as an offset of Coordinated Universal Time (UTC). Specify this value only if you specified a custom end date for your commitment. Specify one of the following values:- During daylight saving time:
07:00:00
- During other times:
08:00:00
- During daylight saving time:
Attached reservations
RESERVATION_NAME
: the name of the attached reservation.RESERVATION_ZONE
: the zone of the attached reservation.REQUIRE_SPECIFIC_RESERVATION_VALUE
: specifies if the attached reservation is a specifically targeted reservation; eithertrue
orfalse
. For more information about specifically targeted reservations, see How reservations work.NUMBER_OF_RESERVED_VMS
: the number of VMs that you want to reserve in the attached reservation.RESERVED_MACHINE_TYPE
: the machine type that you want for the VMs in your attached reservation.- For predefined machine types, use the format
MACHINE_FAMILY-standard-CPUS
; for example,n2-standard-4
. For custom machine types, use the format
MACHINE_FAMILY-custom-CPUS-MEMORY
; for examplen2-custom-4-5120
. For a full list of restrictions, read the specifications for custom machine types.Replace the following:
MACHINE_FAMILY
: the family of machine types; for example, specifyn2
for N2 VMs.CPUS
: the number of vCPUs.MEMORY
: the total memory for a reserved VM. Memory must be a multiple of 256 MB and must be supplied in MB; for example, to create an N2 VM with 4 vCPUs and 5 GB of memory, which is 5120 MB, usen2-custom-4-5120
.
- For predefined machine types, use the format
RESERVED_ACCELERATOR_COUNT
: the number of GPUs you want to add, per VM, in the attached reservation.RESERVED_ACCELERATOR_TYPE
: the type of accelerator you want to add in the attached reservation.INTERFACE_1
andINTERFACE_2
: the type of interface you want the Local SSD disks for each reserved VM to use. Valid options are:scsi
andnvme
. Each Local SSD disk is 375 GB. Repeat thelocalSsds
parameter for each Local SSD disk that you want to add. You can specify up to 24 Local SSD disks.MINIMUM_CPU_PLATFORM
: the minimum CPU platform that you want to specify for the attached reservation.INSTANCE_TEMPLATE_NAME
: the name of the instance template that you want to use to create your attached reservation.SHARE_SETTING
: the type of sharing for the attached reservation. Specify this field with the value asSPECIFIC_PROJECTS
if you want to share your attached reservation across multiple consumer projects. Exclude this field if you want create a single-project reservation.CONSUMER_PROJECT_ID_1
andCONSUMER_PROJECT_ID_2
: the project IDs of the projects that can share this reservation; for example,project-1
andproject-2
. You can include up to 100 consumer projects. These projects must be in the same organization as the owner project. Don't include the ID of the project where you create this reservation, as that project is allowed to consume this reservation by default. Exclude these fields if you want to create a single-project reservation.
Compute Engine creates the commitment and the attached reservations only
if there are enough resources of the specified machine type in the target
zone, and sufficient quota, at the time of your request. If your purchase
was successful, Compute Engine returns a 200
status for your
REST API request.
Examples for purchasing commitments by creating new reservations to attach
The following example scenarios and commands show how you can purchase a commitment for GPUs, Local SSD disks, or both by creating new reservations to attach to that commitment.
Example 1: Purchase a commitment for GPUs by attaching a single new reservation
Suppose you want to purchase a commitment commitment-01
in the
us-central1
region that includes 4 NVIDIA V100 GPUs. You want to
create a new reservation reservation-01
as the attached
reservation for those GPUs. Suppose you also want to specify
Compute Engine to use those reserved GPUs across 2 n1-standard-8
VMs in the us-central1-a
zone. To purchase this example commitment
with its attached reservation, make the following POST
request:
POST https://compute.googleapis.com/compute/v1/projects/my-project/regions/us-central1/commitments { "name": "commitment-01", "plan": "TWELVE_MONTH", "type": "GENERAL_PURPOSE" "resources": [ { "amount": "96", "type": "VCPU" }, { "amount": "638976", "type": "MEMORY" }, { "acceleratorType": "nvidia-tesla-v100", "amount": "4", "type": "ACCELERATOR" } ], "reservations": [ { "name": "reservation-01", "specificReservation": { "count": "2", "instanceProperties": { "guestAccelerators": [ { "acceleratorCount": 2, "acceleratorType": "nvidia-tesla-v100" } ], "machineType": "n1-standard-8" } }, "specificReservationRequired": false, "zone": "us-central1-a" } ] }
Example 2: Purchase a commitment for GPUs without committing to vCPUs or memory
To commit to and reserve GPUs and Local SSD disks without committing to
vCPUs or memory, specify 0
as the value for vCPU and memory quantities.
For example, suppose you want to purchase a commitment commitment-02
for
a single NVIDIA P4 GPU in the us-west2
region. You also want to create
a new reservation as the attached reservation and specify
Compute Engine to use the reserved GPU on an n1-standard-2
VM in
the us-west2-b
zone. To purchase this example commitment with its attached
reservation, make the following POST
request:
POST https://compute.googleapis.com/compute/v1/projects/my-project/regions/us-west2/commitments { "name": "commitment-02", "plan": "TWELVE_MONTH", "type": "GENERAL_PURPOSE", "resources": [ { "amount": "0", "type": "VCPU" }, { "amount": "0", "type": "MEMORY" }, { "acceleratorType": "nvidia-tesla-p4", "amount": "4", "type": "ACCELERATOR" } ], "reservations": [ { "name": "reservation-01", "specificReservation": { "count": "1", "instanceProperties": { "guestAccelerators": [ { "acceleratorCount": 4, "acceleratorType": "nvidia-tesla-p4" } ], "machineType": "n1-standard-2" } }, "specificReservationRequired": false, "zone": "us-west2-b" } ] }
Example 3: Purchase a commitment for GPUs and Local SSD disks by attaching multiple new reservations
Suppose you want to purchase a commitment commitment-03
for 1
NVIDIA V100 GPU and 2 Local SSD disks in the us-central1
region. You also
want to create and attach two reservations in the
us-central1-a
zone. In the first reservation, res-01
, you want to
reserve 1 n1-standard-2
VM with 1 GPU. You want to make res-01
a
targeted reservation, which means that you must specifically target that
reservation by name to use its reserved VMs. In the second reservation,
res-02
, you want to reserve 1 n1-standard-8
VM with 2 types of
attached Local SSD disks. To purchase this example commitment with the
attached reservations, make the following POST
request. Note that the
example commitment also contains vCPU and memory resources.
POST https://compute.googleapis.com/compute/v1/projects/my-project/regions/us-central1/commitments { "name": "commitment-03", "plan": "TWELVE_MONTH", "type": "GENERAL_PURPOSE", "resources": [ { "amount": "96", "type": "VCPU" }, { "amount": "638976", "type": "MEMORY" }, { "acceleratorType": "nvidia-tesla-v100", "amount": "1", "type": "ACCELERATOR" }, { "amount": "768000", "type": "LOCAL_SSD" } ], "reservations": [ { "name": "res-01", "specificReservation": { "count": "1", "instanceProperties": { "guestAccelerators": [ { "acceleratorCount": 1, "acceleratorType": "nvidia-tesla-v100" } ], "machineType": "n1-standard-2" } }, "specificReservationRequired": true, "zone": "us-central1-a" }, { "name": "res-02", "specificReservation": { "count": "1", "instanceProperties": { "localSsds": [ { "diskSizeGb": "375", "interface": "SCSI" }, { "diskSizeGb": "375", "interface": "NVME" } ] "machineType": "n1-standard-8" } }, "specificReservationRequired": false, "zone": "us-central1-a" } ] }
After you purchase a commitment with attached reservations, the reservations remain active as long as the commitment is active. When your commitment expires, Compute Engine automatically deletes any attached reservations. Deletion of these reservations has no effect on any running VM instances that were tied to those reservations. The running VMs continue to run and you are still charged for those VMs.
For the duration of your commitment's term, you cannot delete or resize any attached reservations that contain GPUs, local SSDs, or both. However, you can replace the commitment's existing attached reservations with new ones. For more information on what can and cannot be changed for your attached reservations, see Replace reservations that are attached to commitments.
Purchase commitments for licenses
You can purchase commitments for your licenses if you run your workloads on VMs that use the following operating system (OS) images:
- SUSE Linux Enterprise Server (SLES) images
- SLES for SAP images
The CUD percentages that you receive for license commitments of each OS image depends on the number of vCPUs that your VM uses. The following tables show the CUD percentages for each type of software license commitment:
License commitment type | Number of vCPUs | 1-year CUD percentage | 3-year CUD percentage |
---|---|---|---|
SLES images | 1-2 | 77% | 79% |
SLES images | 3-4 | 54% | 59% |
SLES images | 5+ | 45% | 50% |
SLES for SAP images | 1-2 | 59% | 63% |
SLES for SAP images | 3-4 | 59% | 63% |
SLES for SAP images | 5+ | 59% | 63% |
When you purchase a commitment for licenses, the commitment forms a "pool" of licenses that automatically apply to any running VM instances within a selected project in a specified region. The licenses in the commitment are not tied to any one particular VM. When a VM starts, it takes a committed license from the pool, and when the VM stops it returns the license to the pool, where the license can be used by another VM. As long as there are available committed licenses in the pool, you continue to receive discounts for the premium OS usage.
For example, if you need to run 10 VMs in two regions (5 VMs in us-central1
and 5 VMs in us-west1
) and under the same project ID, you must purchase 5
licenses in each region to cover those running VMs. For each commitment, your
committed licenses can apply to any 5 concurrently running VMs at any time
during the year in the respective region. You are billed monthly for the
commitments regardless of your usage.
After you purchase a commitment, your commitment becomes active on the following day at 12 AM US and Canadian Pacific Time (UTC-8, or UTC-7 during daylight saving time). Compute Engine maintains a lien on your project for each region in your project where you purchase a commitment. When you purchase a new commitment for any region in your project, Compute Engine associates the lien for that region with the newly created commitment.
Between the time of your commitment purchase and its activation time, the
status of your commitment remains as NOT_YET_ACTIVE
(or as PENDING
on the
Google Cloud console). After activation, the status of your commitment changes to
ACTIVE
.
For example, suppose you purchase your commitment on January 20th at 10:00 PM
US and Canadian Pacific Time (UTC-8 or UTC-7). Compute Engine creates your
commitment immediately with its status as NOT_YET_ACTIVE
. However, your
commitment becomes ACTIVE
only on January 21st at 12:00 AM US
and Canadian Pacific Time (UTC-8 or UTC-7).
You can't cancel a license commitment after you purchase it. When your license commitments expire, your running VMs continue to run and you are charged for the licenses at on-demand image prices.
Purchase a license commitment using the Google Cloud console, the Google Cloud CLI, or REST.
Console
Before you purchase a commitment using the Google Cloud console, select the project that you want to use to purchase the commitment. If discount sharing is enabled for a billing account, you can purchase the commitment using any project from that billing account. After you select the project, perform the following steps:
- In the Google Cloud console, go to the Committed Use Discounts page.
- Click Purchase commitment to purchase a new commitment.
- Click New license committed use discount to purchase a new license commitment.
- Name your commitment and choose the region where you want it to apply.
- Choose a duration amount of the commitment, either 1 or 3 years.
- Choose a License family.
- Choose the License type and quantity.
- Choose the Number of licenses.
- Click Purchase.
gcloud
Using the gcloud CLI, run the
gcloud compute commitments create-license
command to purchase a license commitment.
gcloud compute commitments create-license COMMITMENT_NAME \ --license `LICENSE_URI` --amount NUMBER_OF_LICENSES \ --cores-per-license CORES_PER_LICENSE \ --plan PLAN \ --region REGION \
Replace the following:
COMMITMENT_NAME
: the name for your commitment.LICENSE_URI
: the license URI. For example:https://www.googleapis.com/compute/v1/projects/myproject/global/licenses/sles-sap-12
NUMBER_OF_LICENSES
: the number of licenses you plan to purchase.CORES_PER_LICENSE
: the number of cores per license. Enter1-2
3-4
, or5+
.PLAN
: enter the plan length:12-month
or36-month
.REGION
: the region where this commitment applies.
For example, the following commitment is for 4 SAP licenses with 3-4 cores
per license for 36 months in the us-central1
region:
gcloud compute commitments create-license commitment-1 --license https://www.googleapis.com/compute/v1/projects/myproject/global/licenses/sles-12 --amount=4 --cores-per-license=3-4 --plan=36-month --region=us-central1
For example, the following commitment is for 2 SLES for SAP licenses with
1-2 cores per license for 12 months in the us-central1
region:
gcloud compute commitments create-license commitment-2 --license https://www.googleapis.com/compute/v1/projects/myproject/global/licenses/sles-sap-12 --amount=2 --cores-per-license=1-2 --plan=12-month --region=us-central1
REST
Use the regionCommitments.insert
method
and include the licenseResource
field to define the license commitment's
properties.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/commitments?requestId=OPTIONAL_UNIQUE_ID { "name": COMMITMENT_NAME, "plan": PLAN, "category": "LICENSE", "licenseResource": { "coresPerLicense": CORES_PER_LICENSE, "amount": NUMBER_OF_LICENSES, "license": `LICENSE_URI` } }
Replace the following:
COMMITMENT_NAME
: the name for your commitment.LICENSE_URI
: the license URI. For example:https://www.googleapis.com/compute/v1/projects/myproject/global/licenses/sles-sap-12
NUMBER_OF_LICENSES
: the number of licenses you plan to purchase.CORES_PER_LICENSE
: the number of cores per license. Enter1-2
3-4
, or5+
.PLAN
: enter the plan length:12-month
or36-month
.REGION
: the region where this commitment applies.
For example, the following commitment is for 4 SLES for SAP
licenses with 3-4 cores per license for 36 months in the us-central1
region.
POST https://compute.googleapis.com/compute/v1/projects/myproject/regions/us-central1/commitments { "name": "commitment-3", "plan": "THIRTY_SIX_MONTH", "category": "LICENSE", "licenseResource": { "coresPerLicense": "3-4", "amount": "4", "license": "https://www.googleapis.com/compute/v1/projects/suse-sap-cloud/global/licenses/sles-sap-12" } }
Apply committed use discount recommendations
Google Cloud analyzes your VM spending trends with and without a commitment and generates CUDs recommendations. You can use CUD recommendations to optimize your compute costs. You can compare the costs with and without a commitment, and estimate how much you can save each month with a commitment.
CUD recommendations are available in the Google Cloud console. The Recommender generates a card with information about your VM usage over the last 30 days. If your VMs show a trend of uncommitted usage over 30 days, the Recommender classifies this as an opportunity to purchase commitments to reduce your VM costs.
Usage is considered uncommitted and eligible if the following is true.
- The VM was active for the entire duration of the 30 days.
- The VM's SKU is part of an eligible committed use discount bucket.
- The VM's usage was not already covered by an existing commitment.
Recommendations are refreshed once per day and take the previous 30 days of usage history into consideration.
Recommendations for CUDs are generated by two separate algorithms, which you can select from when purchasing (or accepting) them on the summary card.
- Stable usage recommendations cover minimum stable usage over time.
- Optimal recommendations are based on overall usage and might cover resources that are not on all the time.
To learn more about how CUD recommendations work, see Committed use discount Recommender.
Limitations
CUD recommendations are available for the CPU and memory component of machine type commitments only. CUD recommendations are not available for Local SSD disks, GPUs, or license commitments.
Review and accept a recommendation
To learn how to purchase the recommended commitments, see Purchasing recommendations
Dismiss a recommendation
To learn how to dismiss your commitment recommendations or to restore recommendations that were previously dismissed, see Dismissing recommendations
History of recommendations
To learn how to view the history of your applied and dismissed commitment recommendations, see Viewing the history of recommendations.
Enable discount sharing for hardware commitments
By default, hardware resource-based CUDs are applied to the project where you purchased your resource-based commitments and are project-scoped discounts. If you move the project for which you purchased your commitments to a different Cloud Billing account, then you continue to receive the applicable committed use discounts for that project under the new Cloud Billing account.
To share the discount for hardware commitments across eligible usage in all projects linked to your Cloud Billing account, enable committed use discount sharing from the Google Cloud console.
When you enable committed use discount sharing, the commitment scope is changed from Project to Billing account. After you change your commitment scope to Billing account by enabling discount sharing, you cannot disable discount sharing to revert back to project scope. Rather, Cloud Billing Support must perform this action for you.
Discount sharing works in conjunction with your attribution configuration. You can choose to use proportional attribution or prioritized attribution.
Unless you configure your attribution preferences first, when you enable discount sharing, it defaults to using proportional attribution for your Compute Engine resource-based commitments.
If you want to configure your attribution configuration before you enable discount sharing, see choose attribution for resource-based commitments for more information and how to enable each type of attribution.
Complete the following steps to enable committed use discount sharing:
Sign in to your Cloud Billing account in the Google Cloud console.
At the prompt, choose the Cloud Billing account for which you'd like to configure your committed use discounts to use discount sharing. The Billing Overview page opens for the selected Cloud Billing account.
From the Billing navigation menu, select CUD analysis to view the Committed use discounts analysis page.
On the Committed use discount analysis page, from the Commitment type menu, select Resource-based commitments.
Below the Resource based commitments report title, locate the Commitment scope.
- Project scope indicates that discount sharing is not enabled for resource-based committed use discounts. Project-scope discounts are only applied to eligible usage in the project in which the commitments are purchased.
- Billing account scope indicates that discount sharing is already enabled for the resource-based commitments. Billing-account-scope commitments apply the committed use discounts across all eligible usage in all projects associated with the Cloud Billing account.
To change the commitment scope setting, select Edit.
If the current scope is Project, in the text entry box, type Enable to enable discount sharing across the billing account, then click Enable Billing Account Scope to save your changes.
If the current scope is Billing account, then discount sharing is already enabled. To disable discount sharing and revert to Project-scoped commitments, click Contact support.
You only need to enable discount sharing on one project-scoped resource-based commitment to affect the scope of all resource-based commitments in the same Cloud Billing account. When you enable committed use discount sharing, your commitment scope changes as follows:
- All of your current and active resource-based committed use discounts in all of the projects under the same Cloud Billing account, including those you previously purchased and new ones you purchase in the future, are shared across your Cloud Billing account.
- When you change your commitment scope configuration, such as creating a new project linked to the Cloud Billing account, or linking an existing project to the Cloud Billing account, the change takes effect on the following day at 12 AM (midnight) US and Canadian Pacific Time (UTC-8 or UTC-7).
- If you move the project that had the original commitment to a new Cloud Billing account, your discount sharing settings change. For information on the effects of changing the Cloud Billing account for a project, see Change the Cloud Billing account linked to a project.
To get a better understanding of how committed use discounts impact and appear on your bill, see Understand your bill with committed use discounts.
View your commitments
View the list of all your commitments in the Google Cloud console, the Google Cloud CLI, or REST.
Console
In the Google Cloud console, view a list of commitments in the Committed use discounts page.
gcloud
Make a request using the commitments list
command:
gcloud compute commitments list
The tool returns a list of commitments:
NAME REGION END_TIMESTAMP STATUS my-commitment us-east1 2018-03-17T00:00:00.000-07:00 NOT_YET_ACTIVE
REST
You can get a list of commitments across all regions by making an
aggregatedList
request
to the following URL:
https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/aggregated/commitments
Which returns a list of commitments:
"commitments": [ { "kind": "compute#commitment", "id": "3294122326373778983", "creationTimestamp": "2017-02-09T15:18:32.411-08:00", "name": "example-commitment", "region": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1", "selfLink": "https://www.googleapis.com/compute/v1/projects/example-project/regions/us-central1/commitments/example-commitment", "status": "NOT_YET_ACTIVE", "statusMessage": "The commitment is not yet active (its startTimestamp is in the future). It will not apply to current resource usage.", "plan": "TWELVE_MONTH", "startTimestamp": "2017-02-10T00:00:00.000-08:00", "endTimestamp": "2018-02-10T00:00:00.000-08:00", "resources": [ { "type": "VCPU", "amount": "5" }, { "type": "MEMORY", "amount": "32500" }] } ]
Modify a commitment
You can modify your active commitments in the following ways:
- You can change the auto-renew status for your commitment. For more information, see Renew commitments automatically.
- You can extend your commitment's term length beyond the preset 1 or 3 years by specifying a custom end date for your commitment. For more information, see Extend the term duration of commitments.
- You can modify the amount of resources in your hardware commitments by either merging or splitting your existing commitments. For more information, see Merge and split commitments.
- You can upgrade the term of your 1-year hardware commitments and convert them into 3-year commitments. For more information, see Upgrade the term of commitments
- You can change the Cloud Billing account that is linked to, and pays for, the project where you purchased your resource-based commitments. Learn about changing the Cloud Billing account for a project.
After you create the commitment, you can't modify the commitment's project, type, or region.
Cancel a commitment
After you create a commitment, you can't cancel it. You must pay the agreed upon monthly amount for the duration of the commitment. Commitments are not affected by future changes to on-demand prices of your committed Compute Engine resources.
If you accidentally purchased a commitment or made a mistake while configuring your commitment, then you have 14 calendar days from the commitment start date to contact Cloud Billing support for help. Approval of any changes is subject to Google's discretion and isn't assured until confirmed by Google.
Understand your bill with committed use discounts
Read the following documents to gain a better understanding of your billing:
- View and download the cost details of your invoice or statement.
- Analyze the effectiveness of your committed use discounts.
- Understand your savings with cost breakdown reports.
Support
If you have any questions regarding committed use discounts on your bill, you can contact Google Cloud support.
What's next
- Learn how to renew resource-based commitments automatically.
- Learn how to extend the term length of resource-based commitments.
- Learn how to upgrade the term of resource-based commitments.
- Learn how to merge and split resource-based commitments.
- Learn how to analyze the effectiveness of your resource-based CUDs.
- Review the prices of your resources with and without CUDs.