0

I've built a Go binary for handling SSH traffic. And deployed it to Cloud Run.

Looks like cloud run allows only HTTP traffic, and my attempts to connect via ssh -p 80 ***.run.app fails.

How to allow SSH traffic to be passed through? I assume I need to allow TPC connections some how?

Thanks in advance.

Anton Medvedev
  • 3,393
  • 3
  • 28
  • 40
  • Your app must respond to HTTP requests with an HTTP response. SSH is a different protocol. Google Cloud Run also enforces a response timeout so that can be an issue. You must embed SSH traffic within an HTTP tunnel. There are libraries for creating tunnels. However, what benefit will you have doing so? If your goal is to run commands remotely via Cloud Run, create your own HTTP/REST interface wrapping the commands. – John Hanley Jun 21 '23 at 18:55
  • And remember, your container is immutable, your instance ephemeral. Don't expect to make any changes. – guillaume blaquiere Jun 21 '23 at 19:29
  • How long a Cloud Run can process request in background? – Anton Medvedev Jun 21 '23 at 19:52
  • That depends on what you configure. I recommend reading about the `lifecycle` of a Cloud Run instance. https://cloud.google.com/blog/topics/developers-practitioners/lifecycle-container-cloud-run – John Hanley Jun 21 '23 at 20:47

1 Answers1

0

You can't SSH to Cloud Run as it being serverless. Cloud Run can only receive HTTP requests based on this documentation on invoking with an HTTPS Request.

As mentioned by @guillaume blaquiere, container is immutable and instance is ephemeral as Cloud Run being a serverless containerized microservices. Once the instance has been deleted or destroyed, you won't be able to access it as Cloud Run would just create a new one.

It is highly recommended to check out @John Hanley's documentation, as well as the following for your references regarding how Cloud Run works:

Hope this helps.

Robert G
  • 1,583
  • 3
  • 13
  • Actually, there was either an article or a StackOverflow answer on how to tunnel SSH into Cloud Run. It can be done as I mentioned in my comments. – John Hanley Jun 21 '23 at 23:04