A cloud engineer needs to deploy a Compute Engine virtual machine named `app-frontend` using the Google Cloud CLI. The VM must be configured to run with a dedicated custom service account to access Google Cloud resources securely. Additionally, the instance requires initial configuration parameters provided via key-value key pairs at boot time. Which flags should the engineer include in the `gcloud compute instances create` command to satisfy these requirements? (Select TWO.)
- Use `--service-account` followed by the email address of the dedicated custom service account.Answer
- Use `--metadata` followed by key-value pairs to pass custom instance startup parameters.Answer
- CUse `--service-account-key` followed by the file path to a downloaded JSON service account key.
- DUse `--provisioning-model=SPOT` to guarantee continuous, uninterrupted uptime for the application.
Answer
The correct options are specifying `--service-account` with the service account email and using `--metadata` to pass key-value parameters.
Attaching a custom service account via `--service-account` provides proper IAM identity without exposing static keys, while passing configuration data via `--metadata` allows boot-time settings to be read by the virtual machine.
Step-by-Step Solution
Key Concept
Attaching custom service accounts and key-value metadata to Compute Engine instances via gcloud CLI flags.