After creating the start up script, follow these steps:
- With the start up script ready, we can create an instance using the gcloud command:
$ gcloud compute instances create mysite-instance \ --image-family=debian-8 \ --image-project=debian-cloud \ --machine-type=g1-small \ --scopes userinfo-email,cloud-platform \ --metadata-from-file startup-script=./startup-script.sh \ --zone us-east1-c \ --tags mysite-server
- You can check the progress of the instance creation using the following command:
$ gcloud compute instances get-serial-port-output \mysite-instance --zone us-east1-c
- Create a firewall rule to allow access to port 3000 to the instance:
$ gcloud compute firewall-rules create default-allow-http-3000 ...