That's right, instances are charged during their launch. (up to a minute, at least 10 minutes). Instances run from the moment they are launched through the API until they are stopped through the API. It does not matter if any user is logged in via SSH or not. For most cases of automatic use, users never enter the system — programs are installed and run through scripts .
You can view your running instances using the Cloud Console to confirm that they are currently running.
If you want to stop your instance inside the instance, the easiest way is to start the instance using compute-rw Service Scope and use gcutil.
For example, to start an instance from the command line using the calculation area-rw:
$ gcutil --project=<project-id> addinstance <instance name> --service_account_scopes=compute-rw
(this is the default when creating an instance manually through the Cloud Console)
Later, after completing the batch job, you can remove the instance from the instance:
$ gcutil deleteinstance -f <instance name>
Brian dorsey
source share