Skip to content

Instantly share code, notes, and snippets.

@feczo
Last active August 29, 2015 14:02
Show Gist options
  • Save feczo/5677b5de180e969801a0 to your computer and use it in GitHub Desktop.
Save feczo/5677b5de180e969801a0 to your computer and use it in GitHub Desktop.
How to clone a windows compute engine (GCE) instance from command line using gcutil
  1. gcutil addinstance --image=windows-server-2008-r2-dc-v20140609 --zone=europe-west1-windows --machine_type=n1-standard-1 source-windows

  2. Provide a password for the gceadmin account of your Windows instance(s):

  3. wait about 10-15 minutes

  4. confirm that the instance is completely up: gcutil getserialportoutput source-windows output should end with: ------------------------------------------------------------- Instance setup finished. source-windows is ready to use. -------------------------------------------------------------

  5. use RDP to login and customize your instance

  6. addsnapshot --source_disk=source-windows snap-windows

  7. wait till the addsnapshot opration completes with similar: Table of resources: source-windows | READY Table of operations: +---------------------------------------------------------+--------+-------------------------------+----------------+ | name | status | insert-time | operation-type | +---------------------------------------------------------+--------+-------------------------------+----------------+ | operation-[xxxxx]| DONE | 2014-[xxx] | createSnapshot |

  8. Create a new disk from the snapshot gcutil adddisk --source_snapshot=snap-windows --zone=europe-west1-windows win1

  9. wait till Table of resources: win1 | europe-west1-windows | READY | 100

  10. create the clone instance gcutil addinstance --disk='win1,mode=rw,boot' --zone=europe-west1-windows --machine_type=n1-standard-1 win1

wait another 10-15 minutes till the new instance is up similarly to the first one query gcutil getserialportoutput win1 to verify the state

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment