# Settings
NAME=YOUR VM NAME HERE            # For example: jcw-demo-vm
ZONE=YOUR ZONE HERE               # For a complete list, use `gcloud compute zones list | egrep ^us-`
PROJECT=YOUR PROJECT ID HERE      # Insert the GCP Project ID here. This is the one for Wallaroo.
NETWORK=default                   # default network is the default, substitute as needed
RULE_NAME=Wallaroo-admin-console  #port rule name for port 30000

# Create VM
IMAGE=projects/ubuntu-os-cloud/global/images/ubuntu-2204-jammy-v20231030

# Open port 30000. Port 22 and 443 open by default
# this can be modified to any priority as needed
gcloud compute firewall-rules create $RULE_NAME \
 --action=ALLOW \
 --direction=INGRESS \
 --network=$NETWORK \
 --priority=1000 \
 --rules=tcp:30000 \
 --source-ranges=0.0.0.0/0 

# create the instance
gcloud compute instances create $NAME \
 --project=$PROJECT \
 --zone=$ZONE \
 --machine-type=e2-standard-32 \
 --network-interface=network-tier=STANDARD,subnet=default \
 --maintenance-policy=MIGRATE \
 --provisioning-model=STANDARD \
 --no-service-account \
 --no-scopes \
 --tags=https-server \
 --create-disk=boot=yes,image=${IMAGE},size=750,type=pd-standard \
 --no-shielded-secure-boot \
 --no-shielded-vtpm \
 --no-shielded-integrity-mon

# Get the external IP address
gcloud compute instances describe $NAME --zone $ZONE --format='get(networkInterfaces[0].accessConfigs[0].natIP)'