I would like to know if its possible to increase the CPU/memory of the instance on Google Compute Engine? I am currently running a small instance (g1-small) and I would like to move to n1-highmem-2.
Now it's possible: https://cloud.google.com/compute/docs/instances/changing-machine-type-of-stopped-instance
- Go to the VM Instances page .
- In the Name column, click the name of the instance that you want to change the machine type for.
- Click the Stop button to stop the instance, if you have not stopped it yet.
- After the instance stops (this may take couple minutes), click the Edit button at the top of the page.
This is not currently possible on Google Cloud Platform. For now, you can shut down your instance, and create a new instance with the persistent disk of the older instance attached as described in this StackOverflow answer .
Update- AS of the time of writing:
Call this Python function:
gcpChangeMachineType('project-id', 'us-west1-b', 'youInsanceName', 'custom-96-638976')
Put this in the same Python File:
def gcpChangeMachineType(project, zone, instance_name, newType):
import googleapiclient.discovery
compute = googleapiclient.discovery.build('compute', 'v1')
instances = compute.instances()
instances.stop(project=project, zone=zone, instance=instance_name).execute()
instances.setMachineType(project=project, zone=zone, instance=instance_name, body={'machineType':'zones/{zone}/machineTypes/{newType}'.format(zone=zone, newType=newType)}).execute()
instances.start(project=project ,zone=zone, instance=instance_name).execute()
return(instances.get(project=project ,zone=zone, instance=instance_name).execute())
Other possibles machines:
- f1-micro # 1cpu 640MB
- n1-standard-1
- custom-1-6656
- custom-2-13312
- custom-4-26624
- custom-10-66560
- custom-12-79872
- custom-96-638976
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.