Place the following steps in the correct chronological sequence to deploy and verify a Compute Engine virtual machine configured with an automated web server startup script.
- 1Create a local bash script containing the commands to install and start the web server service.
- 2Run `gcloud compute instances create` with the `--metadata-from-file` flag specifying the startup script path.
- 3Execute `gcloud compute instances list` to retrieve the external IP address assigned to the new VM instance.
- 4Send a request to the external IP address in a web browser to confirm that the web server is responding.
Answer
The correct sequence is: Write the local startup script -> Execute gcloud compute instances create with --metadata-from-file -> Run gcloud compute instances list to get the external IP -> Access the external IP in a browser to verify deployment.
The standard deployment workflow starts with authoring the startup script locally. Next, the VM is created using `gcloud compute instances create` while passing `--metadata-from-file startup-script=...`. After creation, `gcloud compute instances list` is used to discover the instance's public IP address. Finally, navigating to the IP address validates that the script executed successfully and the web server is running.
Step-by-Step Solution
Key Concept
Deploying Compute Engine virtual machines with startup scripts using the gcloud CLI