A cloud engineer needs to deploy a custom Compute Engine virtual machine instance named report-worker in zone us-central1-a. The instance requires a custom machine configuration using the E2 machine family with 4 vCPUs and 16 GB (16,384 MB) of RAM. Which gcloud command should the engineer execute to create this VM instance?
- gcloud compute instances create report-worker --zone=us-central1-a --machine-type=e2-custom-4-16384Answer
- Bgcloud compute instances create report-worker --zone=us-central1-a --custom-cpu=4 --custom-memory=16GB
- Cgcloud compute instances create report-worker --zone=us-central1-a --custom-machine-type=e2-4-16
- Dgcloud compute instances create report-worker --zone=us-central1-a --machine-type=e2-custom-4-16
Answer
The command 'gcloud compute instances create report-worker --zone=us-central1-a --machine-type=e2-custom-4-16384' correctly specifies the custom E2 instance type.
To create a Compute Engine instance with a custom machine type using the gcloud CLI, you must pass the custom configuration string to the --machine-type flag. For the E2 family, the required format is e2-custom-VCPUS-MEMORY_MB. Converting 16 GB to megabytes yields 16,384 MB (16 * 1024), making 'e2-custom-4-16384' the valid specification.
Step-by-Step Solution
Key Concept
Custom Machine Type Syntax in gcloud CLI
Estimated Time:1m 30s