Google Cloud VM creates new version on deploy

283 views Asked by At

I am running a Virtual Machine on Google Cloud and am using their SDK to deploy with the following command:

gcloud preview app deploy ./app.yaml

The deployment works, however for every deployment a new instance is created which can only be reached by adding the version id to the domain name. I tried removing older instances through the developer dashboard but they just restart directly after that.

How can I remove the newly created instances and overwrite the default version on the main domain by default when deploying?

2

There are 2 answers

1
Zachary Newman On BEST ANSWER

To do this directly from gcloud, use the following two flags:

  • --set-default:

    Set the deployed version to be the default serving version.

  • --version:

    The version of the app that will be created or replaced by this deployment. If you do not specify a version, one will be generated for you.

(both from gcloud preview app deploy --help).

If you set --version to be the same each time, the current version deployed at that URL will be overwritten, and a new version will not be created on each deployment.

If you use --set-default, the deployed version can be accessed just using the domain name (without the version as a subdomain).

Deleting the other versions by hand in the developer console will be the simplest way to get rid of them.

0
Vincent On

Turns out you can't edit this under Computer Engine > VM Instances. You have to look under AppEngine > Versions and change the default version there + delete the older ones.