Please look at the UPDATE below.
There are two possible workarounds:
Serverless VPC Access enables you to connect from your App Engine app
directly to Compute Engine VM instances, Memorystore instances, Cloud
SQL instances, and any other resources with an internal IP address.
Unfortunately, Serverless VPC Access isn't available for Cloud Run (more in documentation Services not yet supported) at the moment, but there's a Feature Request at the Google Public Issue Tracker you can join, comment and track progress. Also, such service isn't available for App Engine Flex as well.
- If you use App Engine Flex or Cloud Run follow steps below:
- reserve an external static IP
- create
f1-micro
VM instance with reserved external IP address (this likely fits in the Compute Engine free tier)
- create a firewall rule to allow connection to SFTP server from reserved external IP
- create a SOCKS proxy by running a ssh client that routes the traffic through created VM like in this example
- configure ssh2-sftp-client to use SOCKS Proxy
- connect to SFTP
UPDATE:
No need to use any workarounds. Serverless VPC Access is now available for Cloud Run. Have a look at the documentation for more details.