Hello,
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?
Thanks in advance !
Djo
Solved! Go to Solution.
Howdy Djo,
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:
1. Create a new project
2. Run the gcloud command to list my current quota
3. Change the quota through the console
4. Run the gcloud command to list my new current quota and build trust that theory and practice match
5. Change the quota through the CLI
6. Review the quota in the console
Now we would appear to have a match between CLI and console.
For those who are interested, the command I used is the following:
gcloud alpha services quota update --service=compute.googleapis.com --consumer=projects/project-id --metric=compute.googleapis.com/c2_cpus --unit 1/{project}/{region} --value=8 --force
This command sets a quota of 8 cpu (for c2) for the project "project_id" in each region.
If you want to set a quota for all cpu's you have to iterate the command on each of them