I am new to GCP. I’m struggling to set up a quota limit for VMs using gcloud. I would like to forbid access to VM above 8cpu and 16gb.
I have found a command in the documentation that might interest me but I don’t understand how to use it => “gcloud compute project-info update”. In the documentation I did not find any example of quota update…
Is there anyone who has examples/documentation to share?
Howdy DjoDériaux,
Unfortunately, I am not seeing how quotas will be of use to us to prevent the creation of Compute Engine instances of unwanted shapes. Quotas constrain “how much” of something you are prepared to consume. For example, you might set a quota of 64 cores of vCPU … and that will prevent you from creating more than that … but that isn’t the same as shapes. For example, that quota would allow you to create 32 instances of 2 core machines but it would equally allow you to create 8 instances of 8 core machines. I did find the following feature request:
Finally, setting only a quota of 8 cores for CPU/vCPU for a project would be enough. How can I achieve this with gcloud command ? I can’t find any quota-related commands/example in the documentation… DO you have any examples to share ?
Reading here … it seems that we can modify quota through the gcloud (Google Cloud CLI) interface. This feature appears to be in “alpha” release so may change before it becomes generally available. The documentation on the specific commands can be found here. Sadly, I haven’t had the opportunity to test these commands so have no experience to share. Let me suggest that you give this stuff a good read. If it were me, I’d then create a new (disposable) project and “play” at constraints in that project. If something goes wrong, you can always delete/destroy the project. I’d probably try the following:
Create a new project
Run the gcloud command to list my current quota
Change the quota through the console
Run the gcloud command to list my new current quota and build trust that theory and practice match
Change the quota through the CLI
Review the quota in the console
Now we would appear to have a match between CLI and console.