Web Server Sandbox Stack #Deploy with CloudShell
Web Server Sandbox stack with VM, private VPC, load balancer, private Cloud SQL
List of the components used in this stack:
Managed Instance Group
DNS Zone Record
NOTE: If you want to undeploy or update an existing sandbox please proceed directly to Step 3 - Recover
First you need initialize the sandbox configuration. To do this please run the initialization command:
hub stack init
The command will prompt you to enter the
GCP project ID and
will create initial configuration files and download required components.
By default command enable auto configure of sandbox during
Advance case #
For some advanced cases you need to configure sandbox manually.
To do this just pass
hub stack init --disable-auto-configure
And after that to configure sandbox manually run command:
hub stack configure
The Hub CLI produces a state file after provisioning of sandbox,
same as its components, and it must be uploaded to the cloud.
For simplicity, we pre-create
Cloud DNS Zone and
in your GCP project with pre-generated names.
This is done during
Once you are done with the configuration, use the following command to deploy the sandbox:
hub stack deploy
To deploy a specific component on the sandbox:
hub stack deploy -c <name-of-the-component>
To undeploy a specific component on the sandbox:
hub stack undeploy -c <name-of-the-component>
If any of the sandbox components would require additional configuration parameters, users will be asked to provide them.
To delete the sandbox run this command:
hub stack undeploy
component has a set of parameters (key-value pairs) such as
GKE cluster name or number of nodes in a node pool, etc.
parameters section of the
hub.yaml to see what parameters are available.
Any default value can be overridden.
To get more information on how components are implemented refer to their README files.
Google Cloud Shell environments are ephemeral, which means any files stored locally on the Cloud Shell machine will be lost when the machine restarts. Luckily, we store sandbox state files in the Cloud, which means, if we lose a local state, we can always recover it from the Cloud.
To recover your sandbox please follow the steps below.
Switch to your current project:
gcloud config set project <project-id>
List all recent sandboxes deployed to your project and find ID of the sandbox you would like to recover:
hub state ls
Initialize your sandbox:
hub stack init <id>
Hub CLI will find the location of the state file, download it and prepare configuration files.
After stack recovery undeploy or update your existing stack using corresponding commands.