Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

Copying files to Google Cloud shell home directory

How do you copy files from your laptop/desktop to Google Cloud shell home directory of the user?

Going further using cloud shell how can you upload files directly to Google Cloud storage buckets?

1 Answers

I found the answers myself

1. Copy files from local to cloud shell

gcloud alpha cloud-shell scp cloudshell:'FILE_NAME' localhost:.'FILE_NAME'
gcloud alpha cloud-shell scp cloudshell:~/FOLDER/'FILE_NAME' localhost:.'FILE_NAME'

2. To copy a remote directory ‘~/REMOTE-DIR’ on the instance of ‘example-instance’ to ‘~/LOCAL-DIR’ on the local host, run:

gcloud compute scp example-instance:~/REMOTE-DIR ~/LOCAL-DIR --zone=us-central1-a

3. To copy files from your local host to a virtual machine, run:

gcloud compute scp ~/LOCAL-FILE-1 ~/LOCAL-FILE-2 example-instance:~/REMOTE-DIR --zone=us-central1-a
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?