Uploading Files to Google Cloud Storage for Data Migration

Upload Files to Google Cloud Storage

Question

You want to upload files from an on-premises virtual machine to Google Cloud Storage as part of a data migration.

These files will be consumed by Cloud DataProc Hadoop cluster in a GCP environment.

Which command should you use?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.

The gsutil cp command allows you to copy data between your local file.

storage.

boto files generated by running "gsutil config"

The correct answer is B. gcloud cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/

Explanation: To upload files from an on-premises virtual machine to Google Cloud Storage, we can use the gsutil command-line tool or the gcloud command-line tool.

gsutil is a command-line tool that is used to perform operations on Google Cloud Storage. We can use this tool to upload, download, and manage objects in Google Cloud Storage. The correct command to upload a file from an on-premises virtual machine to Google Cloud Storage using gsutil is:

less
gsutil cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/

gcloud is another command-line tool that is used to manage resources on Google Cloud Platform. We can use this tool to manage compute resources, storage resources, and other GCP services. The correct command to upload a file from an on-premises virtual machine to Google Cloud Storage using gcloud is:

less
gcloud cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/

Therefore, option B is the correct answer.

Option C, hadoop fs cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/, is incorrect because hadoop fs is used to copy files between HDFS and the local file system or between two HDFS clusters. It is not used to copy files from an on-premises virtual machine to Google Cloud Storage.

Option D, gcloud dataproc cp [LOCAL_OBJECT] gs://[DESTINATION_BUCKET_NAME]/, is incorrect because the gcloud dataproc command is used to manage Cloud Dataproc clusters, and it does not have a cp command to copy files from an on-premises virtual machine to Google Cloud Storage.