If I create a compute engine instance with no external IP assigned. I can successfully login to the node using gcloud compute ssh "vm_name" --tunnel-through-iap
I would now like to transfer files to the vm from a storage bucket using gsutil, for example (after connecting to vm with ssh) :
gsutil cp gs://bucket_name/file_name outfile_name
I receive, after a while, this message:
INFO 1106 09:11:03.773168 retry_util.py] Retrying request, attempt #1...
The transfer is never successful. I think it cannot connect.
It seems that IAP works over port 22 at least, but does not work with gsutil. I realise the instance has no internet connection, as it has no external IP assigned, but I am trying to use gsutil to copy a file from a Google Cloud bucket in the same region, so anticipated this would work.
How can I get gsutil to work in this case? (or otherwise how can I transfer a file from a storage bucket to an instance without an external IP - I could not find it documented how to do this)
Thanks
Solved! Go to Solution.
Hi @jomram,
Welcome to Google Cloud Community!
A few approaches to achieve your goal of transferring files from a storage bucket to an instance without an external IP:
1. Use a temporary external IP:
This approach is straightforward, but it requires managing the external IP address lifecycle.
2. Use Cloud Storage Transfer Service:
This approach is automated and doesn't require manual IP management, but it might involve additional configuration depending on your specific needs.
3. Use a jump server:
This approach requires managing another server, but it allows you to keep the target instance without an external IP for security reasons.
4. Use a Cloud Storage FUSE client:
This approach provides seamless access to the bucket, but it requires installing additional software on the instance and might not be suitable for all workloads.
Choose the approach that best suits your needs and security requirements. Remember to remove the temporary external IP address if you use that option and ensure proper IAM permissions are configured for each method.
Hi @jomram,
Welcome to Google Cloud Community!
A few approaches to achieve your goal of transferring files from a storage bucket to an instance without an external IP:
1. Use a temporary external IP:
This approach is straightforward, but it requires managing the external IP address lifecycle.
2. Use Cloud Storage Transfer Service:
This approach is automated and doesn't require manual IP management, but it might involve additional configuration depending on your specific needs.
3. Use a jump server:
This approach requires managing another server, but it allows you to keep the target instance without an external IP for security reasons.
4. Use a Cloud Storage FUSE client:
This approach provides seamless access to the bucket, but it requires installing additional software on the instance and might not be suitable for all workloads.
Choose the approach that best suits your needs and security requirements. Remember to remove the temporary external IP address if you use that option and ensure proper IAM permissions are configured for each method.
Thank you, that's really helpful, for the 1st option (which seems to be the most straightforward for my purposes/maintaining my current code) can an ephemeral external IP be assigned (and removed again) after instance creation?
Or is this only possible with a static IP? (I'm just concerned if there are any additional costs associated with a static IP that I do not require).
Also, for FUSE, can you mount a storage bucket multiple times, i.e. the same bucket mounted on multiple instances? If so, this might be a good option.
Thanks again for your help
I'm not sure about the FUSE question, but to remove the external IP:
gcloud compute instances delete-access-config [VM_NAME] --access-config-name="external-nat"
to re-add an ephemeral external IP:
gcloud compute instances add-access-config [VM_NAME] --access-config-name="external-nat"