Medium1 markMultiple Choice

GCP ACE · Question 19 · Domain 3.1: Deploying and implementing Compute Engine resources

You need to create a new Compute Engine instance named 'web-server-01' in the 'us-central1-a' zone using the e2-medium machine type. The instance should use a specific custom service account: 'web-sa@my-project.iam.gserviceaccount.com'.

Which gcloud command should you use?

Answer options:

A.

gcloud compute instances create web-server-01 --zone=us-central1-a --machine-type=e2-medium --service-account=web-sa@my-project.iam.gserviceaccount.com

B.

gcloud compute instances start web-server-01 --zone=us-central1-a --type=e2-medium --sa=web-sa@my-project.iam.gserviceaccount.com

C.

gcloud compute create instance web-server-01 --zone=us-central1-a --machine-type=e2-medium --service-account=web-sa@my-project.iam.gserviceaccount.com

D.

gcloud compute instances create web-server-01 --zone=us-central1-a --machine-type=e2-medium --scopes=web-sa@my-project.iam.gserviceaccount.com

How to approach this question

Recall the standard structure of gcloud compute commands: gcloud compute [RESOURCE] [ACTION] [NAME] [FLAGS].

Full Answer

A.gcloud compute instances create web-server-01 --zone=us-central1-a --machine-type=e2-medium --service-account=web-sa@my-project.iam.gserviceaccount.com✓ Correct
gcloud compute instances create web-server-01 --zone=us-central1-a --machine-type=e2-medium --service-account=web-sa@my-project.iam.gserviceaccount.com
The correct command structure is `gcloud compute instances create [INSTANCE_NAME]`. The flags required to meet the scenario are `--zone`, `--machine-type`, and `--service-account`.

Common mistakes

Confusing the `--service-account` flag with the `--scopes` flag.

Practice the full GCP Associate Cloud Engineer Practice Exam 2

50 questions · hints · full answers · grading

More questions from this exam