
Answer-first summary for fast verification
Answer: Include a startup script to bootstrap the Python application when creating an instance template by running `gcloud compute instance-templates create app-template --metadata-from-file startup-script=/scripts/install_app.sh`.
The correct method is to include a startup script when creating the instance template using the `--metadata-from-file` flag with `startup-script=/scripts/install_app.sh`. This approach ensures the script is executed automatically upon instance startup, eliminating the need for manual intervention and leveraging the autoscaling feature effectively. The other options either introduce manual steps, which are inefficient and error-prone, or use incorrect flags (`startup-script-url` or `--startup-script`) that do not work as intended with the `gcloud compute instance-templates create` command.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You are planning to deploy a Python application to an autoscaled managed instance group on Compute Engine using GCP Deployment Manager. What is the most efficient method to deploy the application onto the instances without adding unnecessary complexity?
A
Once the instance starts up, manually connect over SSH and install the application.
B
Include a startup script to bootstrap the Python application when creating an instance template by running gcloud compute instance-templates create app-template --metadata-from-file startup-script=/scripts/install_app.sh.
C
Include a startup script to bootstrap the Python application when creating an instance template by running gcloud compute instance-templates create app-template --metadata-from-file startup-script-url=/scripts/install_app.sh.
D
Include a startup script to bootstrap the Python application when creating an instance template by running gcloud compute instance-templates create app-template --startup-script=/scripts/install_app.sh.