<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SFTP Connection Timeout on Job Cluster but Works on Serverless Compute in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sftp-connection-timeout-on-job-cluster-but-works-on-serverless/m-p/121373#M46437</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/120469"&gt;@Edoa&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a common networking issue in Databricks related to the different network configurations between Serverless Compute and Job Clusters.&lt;BR /&gt;Here are the key differences and potential solutions:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Root Cause&lt;/STRONG&gt;&lt;BR /&gt;Serverless Compute runs in Databricks' managed infrastructure with pre-configured network access,&lt;BR /&gt;while Job Clusters run in your workspace's VPC/network with potentially more restrictive networking rules.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Potential Solutions&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1. Network Security Groups/Firewall Rules&lt;/STRONG&gt;&lt;BR /&gt;Check your cloud provider's network security configuration:&lt;BR /&gt;For AWS:&lt;BR /&gt;- Ensure your VPC security groups allow outbound traffic on port 22&lt;BR /&gt;- Check NACLs (Network Access Control Lists) for outbound SSH rules&lt;/P&gt;&lt;P&gt;For Azure:&lt;BR /&gt;- Verify Network Security Groups allow outbound port 22&lt;BR /&gt;- Check if Azure Firewall is blocking the connection&lt;/P&gt;&lt;P&gt;For GCP:&lt;BR /&gt;- Review VPC firewall rules for outbound SSH access&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Databricks Network Configuration&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;# Try specifying explicit timeout and connection parameters&lt;BR /&gt;import paramiko&lt;BR /&gt;import socket&lt;/P&gt;&lt;P&gt;def connect_with_retry(host, port, username, password, timeout=30):&lt;BR /&gt;try:&lt;BR /&gt;# Create socket with explicit timeout&lt;BR /&gt;sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&lt;BR /&gt;sock.settimeout(timeout)&lt;BR /&gt;&lt;BR /&gt;transport = paramiko.Transport(sock)&lt;BR /&gt;transport.connect((host, port))&lt;BR /&gt;transport.auth_password(username, password)&lt;BR /&gt;&lt;BR /&gt;return transport&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"Connection failed: {e}")&lt;BR /&gt;raise&lt;/P&gt;&lt;P&gt;# Usage&lt;BR /&gt;transport = connect_with_retry(host, 22, username, password)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;3. Alternative Connection Methods&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;# Try using SSHClient instead of Transport directly&lt;BR /&gt;client = paramiko.SSHClient()&lt;BR /&gt;client.set_missing_host_key_policy(paramiko.AutoAddPolicy())&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt;client.connect(&lt;BR /&gt;hostname=host,&lt;BR /&gt;port=port,&lt;BR /&gt;username=username,&lt;BR /&gt;password=password,&lt;BR /&gt;timeout=30,&lt;BR /&gt;banner_timeout=30,&lt;BR /&gt;auth_timeout=30&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;sftp = client.open_sftp()&lt;BR /&gt;# Your SFTP operations here&lt;BR /&gt;&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"Connection error: {e}")&lt;BR /&gt;finally:&lt;BR /&gt;client.close()&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4. VPC Endpoints/Private Connectivity&lt;/STRONG&gt;&lt;BR /&gt;If your SFTP server is internal, consider:&lt;BR /&gt;- Setting up VPC endpoints for private connectivity&lt;BR /&gt;- Using Databricks Private Link if available&lt;BR /&gt;- Configuring custom DNS resolution&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5. Cluster Configuration&lt;/STRONG&gt;&lt;BR /&gt;Add these configurations to your job cluster:&lt;BR /&gt;&lt;BR /&gt;# In cluster spark configuration&lt;BR /&gt;spark.conf.set("spark.databricks.cluster.profile", "serverless") # If available&lt;/P&gt;&lt;P&gt;Or use init scripts to configure networking:&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;BR /&gt;# Example init script for network troubleshooting&lt;BR /&gt;echo "nameserver 8.8.8.8" &amp;gt;&amp;gt; /etc/resolv.conf&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;6. Diagnostic Steps&lt;/STRONG&gt;&lt;BR /&gt;Add this debugging code to understand the network situation:&lt;/P&gt;&lt;P&gt;import socket&lt;BR /&gt;import subprocess&lt;/P&gt;&lt;P&gt;def diagnose_connectivity(host, port=22):&lt;BR /&gt;# Test basic connectivity&lt;BR /&gt;try:&lt;BR /&gt;sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&lt;BR /&gt;sock.settimeout(10)&lt;BR /&gt;result = sock.connect_ex((host, port))&lt;BR /&gt;sock.close()&lt;BR /&gt;&lt;BR /&gt;if result == 0:&lt;BR /&gt;print(f"✓ Port {port} is reachable on {host}")&lt;BR /&gt;else:&lt;BR /&gt;print(f"✗ Port {port} is not reachable on {host}")&lt;BR /&gt;&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"Connection test failed: {e}")&lt;BR /&gt;&lt;BR /&gt;# Test DNS resolution&lt;BR /&gt;try:&lt;BR /&gt;ip = socket.gethostbyname(host)&lt;BR /&gt;print(f"✓ DNS resolution: {host} -&amp;gt; {ip}")&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"✗ DNS resolution failed: {e}")&lt;/P&gt;&lt;P&gt;# Run diagnostics&lt;BR /&gt;diagnose_connectivity("xxx.yyy.com")&lt;/P&gt;&lt;P&gt;7. Workaround: Use Databricks Connect&lt;BR /&gt;If possible, consider using Databricks Connect to run the SFTP operations from your local environment or&lt;BR /&gt;a VM with proper network access.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Recommended Approach&lt;/STRONG&gt;&lt;BR /&gt;First, run the diagnostic code to understand what's failing&lt;BR /&gt;Then, check your cloud provider's network security groups/firewall rules&lt;BR /&gt;Finally, try the alternative connection methods with explicit timeouts&lt;/P&gt;&lt;P&gt;The most likely solution is updating your VPC's outbound security&lt;BR /&gt;group rules to allow port 22 traffic to your SFTP server's IP range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jun 2025 19:52:02 GMT</pubDate>
    <dc:creator>lingareddy_Alva</dc:creator>
    <dc:date>2025-06-10T19:52:02Z</dc:date>
    <item>
      <title>SFTP Connection Timeout on Job Cluster but Works on Serverless Compute</title>
      <link>https://community.databricks.com/t5/data-engineering/sftp-connection-timeout-on-job-cluster-but-works-on-serverless/m-p/121350#M46431</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm experiencing inconsistent behavior when connecting to an SFTP server using Paramiko in Databricks.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;When I run the code on &lt;STRONG&gt;Serverless Compute&lt;/STRONG&gt;, the connection to xxx.yyy.com via SFTP works correctly.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;When I run the &lt;STRONG&gt;same code&lt;/STRONG&gt; on a &lt;STRONG&gt;Job Cluster&lt;/STRONG&gt;, it fails with the following error:&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;SSHException: Unable to connect to xxx.yyy.com: [Errno 110] Connection timed out&lt;/PRE&gt;&lt;P&gt;Key snippet:&lt;/P&gt;&lt;PRE&gt;transport = paramiko.Transport((host, port))&lt;BR /&gt;transport.connect(username=username, password=password)&lt;/PRE&gt;&lt;P&gt;Is there any workaround or configuration needed to align the &lt;STRONG&gt;Job Cluster&lt;/STRONG&gt; network permissions with those of &lt;STRONG&gt;Serverless Compute&lt;/STRONG&gt;, especially to allow outbound SFTP (port 22) connections?&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 15:21:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sftp-connection-timeout-on-job-cluster-but-works-on-serverless/m-p/121350#M46431</guid>
      <dc:creator>Edoa</dc:creator>
      <dc:date>2025-06-10T15:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: SFTP Connection Timeout on Job Cluster but Works on Serverless Compute</title>
      <link>https://community.databricks.com/t5/data-engineering/sftp-connection-timeout-on-job-cluster-but-works-on-serverless/m-p/121373#M46437</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/120469"&gt;@Edoa&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a common networking issue in Databricks related to the different network configurations between Serverless Compute and Job Clusters.&lt;BR /&gt;Here are the key differences and potential solutions:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Root Cause&lt;/STRONG&gt;&lt;BR /&gt;Serverless Compute runs in Databricks' managed infrastructure with pre-configured network access,&lt;BR /&gt;while Job Clusters run in your workspace's VPC/network with potentially more restrictive networking rules.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Potential Solutions&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;1. Network Security Groups/Firewall Rules&lt;/STRONG&gt;&lt;BR /&gt;Check your cloud provider's network security configuration:&lt;BR /&gt;For AWS:&lt;BR /&gt;- Ensure your VPC security groups allow outbound traffic on port 22&lt;BR /&gt;- Check NACLs (Network Access Control Lists) for outbound SSH rules&lt;/P&gt;&lt;P&gt;For Azure:&lt;BR /&gt;- Verify Network Security Groups allow outbound port 22&lt;BR /&gt;- Check if Azure Firewall is blocking the connection&lt;/P&gt;&lt;P&gt;For GCP:&lt;BR /&gt;- Review VPC firewall rules for outbound SSH access&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2. Databricks Network Configuration&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;# Try specifying explicit timeout and connection parameters&lt;BR /&gt;import paramiko&lt;BR /&gt;import socket&lt;/P&gt;&lt;P&gt;def connect_with_retry(host, port, username, password, timeout=30):&lt;BR /&gt;try:&lt;BR /&gt;# Create socket with explicit timeout&lt;BR /&gt;sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&lt;BR /&gt;sock.settimeout(timeout)&lt;BR /&gt;&lt;BR /&gt;transport = paramiko.Transport(sock)&lt;BR /&gt;transport.connect((host, port))&lt;BR /&gt;transport.auth_password(username, password)&lt;BR /&gt;&lt;BR /&gt;return transport&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"Connection failed: {e}")&lt;BR /&gt;raise&lt;/P&gt;&lt;P&gt;# Usage&lt;BR /&gt;transport = connect_with_retry(host, 22, username, password)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;3. Alternative Connection Methods&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;# Try using SSHClient instead of Transport directly&lt;BR /&gt;client = paramiko.SSHClient()&lt;BR /&gt;client.set_missing_host_key_policy(paramiko.AutoAddPolicy())&lt;/P&gt;&lt;P&gt;try:&lt;BR /&gt;client.connect(&lt;BR /&gt;hostname=host,&lt;BR /&gt;port=port,&lt;BR /&gt;username=username,&lt;BR /&gt;password=password,&lt;BR /&gt;timeout=30,&lt;BR /&gt;banner_timeout=30,&lt;BR /&gt;auth_timeout=30&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;sftp = client.open_sftp()&lt;BR /&gt;# Your SFTP operations here&lt;BR /&gt;&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"Connection error: {e}")&lt;BR /&gt;finally:&lt;BR /&gt;client.close()&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4. VPC Endpoints/Private Connectivity&lt;/STRONG&gt;&lt;BR /&gt;If your SFTP server is internal, consider:&lt;BR /&gt;- Setting up VPC endpoints for private connectivity&lt;BR /&gt;- Using Databricks Private Link if available&lt;BR /&gt;- Configuring custom DNS resolution&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5. Cluster Configuration&lt;/STRONG&gt;&lt;BR /&gt;Add these configurations to your job cluster:&lt;BR /&gt;&lt;BR /&gt;# In cluster spark configuration&lt;BR /&gt;spark.conf.set("spark.databricks.cluster.profile", "serverless") # If available&lt;/P&gt;&lt;P&gt;Or use init scripts to configure networking:&lt;/P&gt;&lt;P&gt;#!/bin/bash&lt;BR /&gt;# Example init script for network troubleshooting&lt;BR /&gt;echo "nameserver 8.8.8.8" &amp;gt;&amp;gt; /etc/resolv.conf&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;6. Diagnostic Steps&lt;/STRONG&gt;&lt;BR /&gt;Add this debugging code to understand the network situation:&lt;/P&gt;&lt;P&gt;import socket&lt;BR /&gt;import subprocess&lt;/P&gt;&lt;P&gt;def diagnose_connectivity(host, port=22):&lt;BR /&gt;# Test basic connectivity&lt;BR /&gt;try:&lt;BR /&gt;sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)&lt;BR /&gt;sock.settimeout(10)&lt;BR /&gt;result = sock.connect_ex((host, port))&lt;BR /&gt;sock.close()&lt;BR /&gt;&lt;BR /&gt;if result == 0:&lt;BR /&gt;print(f"✓ Port {port} is reachable on {host}")&lt;BR /&gt;else:&lt;BR /&gt;print(f"✗ Port {port} is not reachable on {host}")&lt;BR /&gt;&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"Connection test failed: {e}")&lt;BR /&gt;&lt;BR /&gt;# Test DNS resolution&lt;BR /&gt;try:&lt;BR /&gt;ip = socket.gethostbyname(host)&lt;BR /&gt;print(f"✓ DNS resolution: {host} -&amp;gt; {ip}")&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"✗ DNS resolution failed: {e}")&lt;/P&gt;&lt;P&gt;# Run diagnostics&lt;BR /&gt;diagnose_connectivity("xxx.yyy.com")&lt;/P&gt;&lt;P&gt;7. Workaround: Use Databricks Connect&lt;BR /&gt;If possible, consider using Databricks Connect to run the SFTP operations from your local environment or&lt;BR /&gt;a VM with proper network access.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Recommended Approach&lt;/STRONG&gt;&lt;BR /&gt;First, run the diagnostic code to understand what's failing&lt;BR /&gt;Then, check your cloud provider's network security groups/firewall rules&lt;BR /&gt;Finally, try the alternative connection methods with explicit timeouts&lt;/P&gt;&lt;P&gt;The most likely solution is updating your VPC's outbound security&lt;BR /&gt;group rules to allow port 22 traffic to your SFTP server's IP range.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 19:52:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sftp-connection-timeout-on-job-cluster-but-works-on-serverless/m-p/121373#M46437</guid>
      <dc:creator>lingareddy_Alva</dc:creator>
      <dc:date>2025-06-10T19:52:02Z</dc:date>
    </item>
  </channel>
</rss>

