Question

Difficulty: EasyDeploying and Managing Compute Engine Virtual Machines

A cloud administrator needs to provision a new Compute Engine virtual machine named `web-server-01` using the Google Cloud CLI (`gcloud`). The instance must be configured with the `e2-standard-4` machine type. Which command flag must be included in the `gcloud compute instances create` command to specify this machine configuration?

  1. --machine-type=e2-standard-4Answer
  2. B
    --instance-type=e2-standard-4
  3. C
    --flavor=e2-standard-4
  4. D
    --custom-vm=e2-standard-4

Answer

The correct option is `--machine-type=e2-standard-4` because `--machine-type` is the mandatory Google Cloud CLI flag for setting the virtual machine configuration specs during creation.
The `--machine-type` flag is the exact gcloud parameter designed to select predefined compute shapes (e.g., `e2-standard-4`) or custom machine specifications during instance creation.

Step-by-Step Solution

1
Identify the required Google Cloud CLI command for provisioning virtual machines.
The command family is `gcloud compute instances create [INSTANCE_NAME]`.
This is the core gcloud command for creating Compute Engine VMs.
2
Select the correct flag to specify the hardware instance size.
Use the `--machine-type` flag followed by the desired machine type name.
Google Cloud CLI requires `--machine-type` to designate predefined or custom compute shapes.

Key Concept

Compute Engine VM Provisioning via gcloud CLI
Rate this question