Skip to content

Instantly share code, notes, and snippets.

View asafamr's full-sized avatar

Asaf Amrami asafamr

View GitHub Profile
@asafamr
asafamr / clone.sh
Last active January 28, 2020 08:37
Clone GCP instance using gcloud cli. google cloud, clone instance, create similar, programatically, script. --- creates a snapshot and an instance template from an instance, then creates new instances using them
#!/usr/bin/env bash
if [ $# -lt 2 ]
then
cat << EOF
usage: `basename "$0"` [-g <group-name> ] <source-instance-name> <cloned-instance-name1> [<cloned-instance-name2>... N]
Clone the source instance in the same region N+1 times and possbliy put all cones into a new unmanaged instance group
-g <group name>(optional)- use this flag to put all newly created instnaces into