-
-
Save sumitdhameja/cf549b31d1081659d7ca to your computer and use it in GitHub Desktop.
A simple Bash function to wrap the `gcloud compute instances create` sub-command, making it easier to work with.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Possibly add this to ~/.bash_profile | |
# Ensure you have the Google Cloud SDK installed | |
function gce-create() { | |
GCE_BIN=$(which gcloud) | |
GCE_SCOPES=default="https://www.googleapis.com/auth/cloud.useraccounts.readonly","https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring.write" | |
GCE_IMAGE="https://www.googleapis.com/compute/v1/projects/centos-cloud/global/images/centos-7-v20160219" | |
GCE_POLICY=MIGRATE | |
GCE_ZONE=us-central1-a | |
GCE_TYPE=f1-micro | |
GCE_NETWORK=default | |
${GCE_BIN} compute instances create $1 --maintenance-policy ${GCE_POLICY} --scopes ${GCE_SCOPES} --image ${GCE_IMAGE} --zone ${GCE_ZONE} --machine-type ${GCE_TYPE} --network ${GCE_NETWORK} ${@:2} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment