Reputation: 49
I'm trying to deploy my python application, using the following commands
gcloud config set project proj-name
gcloud config set account [email protected]
gcloud preview app deploy app.yaml
and I get the following error:
CPU Quota Exceeded: in use: 8, requested: 2, limit: 8
Why does the google app engine create so many VM instances? How can I correctly deploy my app? Can someone explain this to me step by step? I'm just an analyst, not a web developer.
Upvotes: 1
Views: 4785
Reputation: 2518
The reason it creates so many instances is because each time you deploy you are creating a new version. If you type
gcloud preview app versions list
You can see them, or in the Cloud console. You can delete some of the old ones. One simple way to stop this is to always stop the previous version:
gcloud preview app deploy --stop-previous-version
Or you could re-deploy onto the same version:
gcloud preview app deploy --version=staging
and if that version is the one receiving traffic it will work as you expect.
The reason the tooling works the way it does is for people who want to deploy a new version and verify it's ok before they redirect traffic to it, and have the ability to quickly rollback to previous versions if something goes wrong. It can be a bit confusing for newcomers.
Also, based on your post, you are using App Engine Flexible which actually creates VM instances to serve from. If you want to lower your usage, you might restrict your App to just one 1 instance (probably not what you want in production, but maybe what you want in development). To do that, add this to your app.yaml:
# Lock instances to 1
manual_scaling:
instances: 1
Leave a comment if you have any more questions.
Upvotes: 9