简体   繁体   中英

SECURE Connection to GCP VM Instance and pull files out

This is a similar question - How to connect and access Google Cloud Compute Engine VM via Python 3.6

I have two projects A and B

I would like to run python script on VM from project B and well and locally to connect to VM on project A and full list of files from folder /test/

Ideally by using Google API not third party packages like - https://docs.paramiko.org/en/2.6/

There is an official Python client library for GCP but a connection to an instance is not supported with the APIs.

What you can do is use Cloud SDK that can be installed on any instance and your local machine.

In particular the command to connect is:

gcloud compute ssh EXAMPLE-INSTANCE --zone=ZONE

Before running the command from your local machine yo have to authenticate into project A.

Finally to connect from instance in Project B to your instance in project A

gcloud compute ssh EXAMPLE-INSTANCE --zone=ZONE --project=PROJECT-B

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM