Which command should you use to copy an entire directory to a Compute Engine VM instance?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Prepare for the Google Cloud Professional Cloud Developer Test. Benefit from mock assessments featuring flashcards and multiple-choice format, each furnished with hints and detailed explanations. Excel in your exam with confidence!

The command that correctly facilitates the copying of an entire directory to a Compute Engine VM instance is one that utilizes gcloud compute scp. This command is specifically designed for secure copying (SCP) of files between your local machine and Google Cloud VM instances. The use of the --recurse flag allows for the entire directory structure, including its contents, to be copied recursively to the specified destination on the VM.

The command is straightforward and effectively manages the SSH and SCP protocols behind the scenes, ensuring that files are transferred securely. Including options such as --project helps in clearly specifying which GCP project the resources belong to, and the --zone option is essential for targeting the correct Compute Engine zone where the instance resides.

Other potential choices suggest using gsutil, which is aimed at transferring data to and from Google Cloud Storage rather than direct file transfers to VM instances. This makes them unsuitable for the intended operation. Additionally, using gcloud compute mv is incorrect because, while it may involve moving files within Google Cloud, it does not serve the purpose of copying files from a local machine to a VM instance. Thus, the command that utilizes gcloud compute scp is the optimal choice for this task

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy