Copy the local directory local-scripts and its contents from your workstation to a Compute Engine instance. Which command should you use?
Choose an answer
Tap an option to check your answer.
Correct answer: gcloud compute scp --project ■€my-gcp-project■€ --recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone ■€us-east1-b■€.
Why this is the answer
The correct command is gcloud compute scp --project my-gcp-project --recurse ~/local-scripts/ gcp-instance-name:~/server-scripts/ --zone us-east1-b. This command uses gcloud compute scp, which is the dedicated Google Cloud CLI command for securely copying files to and from Compute Engine instances. The --recurse flag is essential for copying directories and their contents. The gsutil cp commands are incorrect because gsutil is used for interacting with Cloud Storage buckets, not directly with Compute Engine instances. While gsutil can copy files, it's not the appropriate tool for direct instance-to-instance or local-to-instance file transfers. The gcloud compute mv command is incorrect because mv is for moving files, not copying, and it's not the standard command for transferring files to a remote Compute Engine instance.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed