I Checked the External Communications During dbt v2 Execution

I Checked the External Communications During dbt v2 Execution

To use dbt v2 in an environment where internet access is not allowed, I tested how to identify the required communication destinations and how to configure them.
2026.12.06

This page has been translated by machine translation. View original

Introduction

This article covers what I tried in order to use dbt v2 (hereafter referred to as dbt) in an environment where communication to the internet is not allowed.

Communication that dbt v2 makes externally

The network requirements and telemetry of dbt v2 are described below.

https://docs.getdbt.com/docs/fusion/fusion-networking

https://docs.getdbt.com/reference/global-configs/usage-stats

When dbt runs, it communicates externally. The documents above list the external connection destinations at runtime, such as the telemetry destination (https://p.vx.dbt.com).

In this article, I verified the behavior for the following destinations.

Destination Purpose When needed
Snowflake PrivateLink host Connection to the database Always
public.cdn.getdbt.com Installation, driver retrieval, version check At installation, at runtime (version check)
p.vx.dbt.com Telemetry Every run
hub.getdbt.com, codeload.github.com dbt deps (Hub packages) When retrieving packages

Configuration

I verified with the following configuration.

  • Snowflake
    • An account on AWS with the Business Critical edition (a requirement for using PrivateLink)
    • Connect via PrivateLink
  • dbt
    • dbt v2 (Fusion, 2.0.14) installed and used on an Amazon Linux 2023 EC2 instance
    • The EC2 instance is placed in a private subnet and connected to via AWS Systems Manager Session Manager
    • Connect to Snowflake via PrivateLink using key pair authentication
  • NAT gateway
    • Created in a public subnet and used for installation and driver retrieval
    • Deleted partway through the verification so that the environment cannot reach the internet

Trying it out

We start from the state where you are logged in to the EC2 instance.

1. Install dbt v2

With the NAT in place, install dbt v2 with the installation script and retrieve the drivers.

curl -fsSL https://public.cdn.getdbt.com/fs/install/install.sh | sh -s -- --update
exec $SHELL
dbt --version
dbt system install-drivers

Confirm that the version is displayed with dbt --version (it was 2.0.14 in this article). dbt system install-drivers is a command that retrieves the drivers needed at runtime in advance. Since installation and driver retrieval require communication to public.cdn.getdbt.com, do them while the NAT is in place.

The profiles.yml was set up as follows. Values are loaded from environment variables.

pl_test:
  target: dev
  outputs:
    dev:
      type: snowflake
      account: "{{ env_var('SNOWFLAKE_ACCOUNT') }}"
      user: "{{ env_var('SNOWFLAKE_USER') }}"
      role: SYSADMIN
      private_key_path: "{{ env_var('SNOWFLAKE_PRIVATE_KEY_PATH') }}"
      private_key_passphrase: "{{ env_var('DBT_ENV_SECRET_SNOWFLAKE_KEY_PASSPHRASE') }}"
      database: "{{ env_var('DBT_DATABASE') }}"
      warehouse: COMPUTE_WH
      schema: "{{ env_var('DBT_DEV_SCHEMA') }}"
      threads: 4

For SNOWFLAKE_ACCOUNT, I specified the account identifier for PrivateLink in the format <organization name>-<account name>.privatelink. The account name contained an underscore, but the connection worked as it was.

With the NAT in place, I first confirmed that the connection works.

cd ~/pl_test
dbt debug
 Debugging connection test: OK
  Debugged All checks passed!

Finished 'debug' successfully for target 'dev' [1.0s]

The connection worked without any problems.

3. Remove the NAT and run dbt build

I deleted the NAT gateway so that the environment could not reach the internet.

curl -m 5 -sS https://example.com || echo "no internet"
curl: (28) Connection timed out after 5002 milliseconds
no internet

In this state, I ran dbt build.

$ dbt build
       dbt 2.0.14
   Loading ~/.dbt/profiles.yml
 Succeeded model DBT_OLC_PLTEST.hello (view) [1 of 1 in 0.30s]

Checking the logs and the Snowflake side, the model creation succeeded.
However, the run did not finish afterward, and the run summary that is normally displayed (Finished 'build' successfully ...) was not output. You can return with Ctrl+C.

4. Investigate the destinations being waited on

While dbt build was running, I checked the connections that had not completed (ss -tnp state syn-sent) and matched their destinations against the name resolution results of candidate hostnames to identify the destinations being waited on.

The Snowflake connection was not included, and connections to the following two places were waiting for a response.

Hostname Purpose
p.vx.dbt.com Telemetry
public.cdn.getdbt.com Version check

At the end of a run, dbt build tried to connect for telemetry transmission and the version check, and kept waiting without a response.

  • In my environment, I interrupted with Ctrl+C after waiting 20 to 28 seconds, and I have not confirmed how long it takes to time out naturally.

5. Try disabling telemetry

Telemetry is described below.

https://docs.getdbt.com/reference/global-configs/usage-stats?version=2

The main characteristics are as follows.

  • In dbt v2, telemetry is enabled by default
  • To disable it, set the environment variable DBT_ENGINE_SEND_ANONYMOUS_USAGE_STATS=false
  • If the destination (https://p.vx.dbt.com) cannot be reached, dbt v2 outputs an error to the log on every run
    • To suppress this error without allowing the destination, you are advised to disable telemetry

In addition to the setting described in the documentation, I added DBT_SEND_ANONYMOUS_USAGE_STATS and --no-send-anonymous-usage-stats, which were listed in dbt build --help, and compared whether a pending connection to p.vx.dbt.com remained after the run.

The results are as follows: with dbt v2 (2.0.14), the connection for telemetry disappeared with every setting.

Setting p.vx.dbt.com (telemetry) public.cdn.getdbt.com
None Waiting for connection Waiting for connection
DBT_ENGINE_SEND_ANONYMOUS_USAGE_STATS=false None Waiting for connection
DBT_SEND_ANONYMOUS_USAGE_STATS=false None Waiting for connection
--no-send-anonymous-usage-stats None Waiting for connection

6. Disable the version check as well

Even with telemetry disabled, the pending connection to public.cdn.getdbt.com remained and dbt build did not return.

Checking dbt build --help, there was an option to disable the version check.

      --no-version-check
          Disable online version check for dbt updates
          [env: DBT_DISABLE_VERSION_CHECK=]

I ran it with this option set as well.

time dbt build --no-send-anonymous-usage-stats --no-version-check

As shown below, it finished immediately and the run summary was also displayed.

 Succeeded model DBT_PLTEST.hello (view) [1 of 1 in 0.30s]

Finished 'build' successfully for target 'dev' [1.3s]
Processed: 1 model
Summary: 1 total | 1 success

real    0m1.368s

The same result was obtained when specifying them with environment variables.

export DBT_SEND_ANONYMOUS_USAGE_STATS=false
export DBT_DISABLE_VERSION_CHECK=1
time dbt build
Finished 'build' successfully for target 'dev' [1.0s]
Processed: 1 model
Summary: 1 total | 1 success

real    0m1.027s

From the above, the causes of the run not finishing in the closed network were the following two communications here. If both are disabled, it finishes normally.

Communication Destination Setting to disable
Telemetry p.vx.dbt.com DBT_SEND_ANONYMOUS_USAGE_STATS=false
Version check public.cdn.getdbt.com DBT_DISABLE_VERSION_CHECK=1

7. Add a package (dbt deps)

In a closed network, retrieving packages also requires communication. Let's try specifying dbt_utils in packages.yml.

packages:
  - package: dbt-labs/dbt_utils
    version: [">=1.3.0", "<2.0.0"]

When I ran dbt deps without the NAT, it did not finish even after 60 seconds.

$ timeout 60 dbt deps --no-send-anonymous-usage-stats --no-version-check
       dbt 2.0.14
   Started resolving packages from packages.yml
(60 秒で打ち切り)

With the NAT in place, it could be retrieved as follows.

 Installed dbt-labs/dbt_utils: 1.4.2
 Installed 1 package

Finished 'deps' successfully [280ms]

Since the destinations are not output even with --debug, I captured the connection destinations of dbt deps with strace and matched them against the name resolution results. The destinations were the following two.

Hostname Purpose
hub.getdbt.com Package index (Package Hub)
codeload.github.com Retrieval of the package itself (GitHub archive)

To retrieve Hub packages with dbt deps, these two hosts were required.

On the other hand, if dbt_packages/ has already been retrieved, it can run without the NAT. With the NAT removed, I ran dbt build including a model that uses a dbt_utils macro, and two models succeeded.

 Succeeded model DBT_OLC_PLTEST.use_utils (view) [1 of 2 in 0.41s]
 Succeeded model DBT_OLC_PLTEST.hello (view) [2 of 2 in 0.61s]

Finished 'build' successfully for target 'dev' [1.5s]
Processed: 2 models
Summary: 2 total | 2 success

It is also possible to retrieve packages (dbt deps) only in an environment that can reach the internet and run in the closed network.

Summary of settings for using dbt v2 in a closed network

In a local development environment in a closed network, the environment variables to set are as follows.

export DBT_SEND_ANONYMOUS_USAGE_STATS=false
export DBT_DISABLE_VERSION_CHECK=1

The hosts required if you allow external communication are as follows.

Host When needed Notes
Snowflake PrivateLink host (account URL, OCSP) Always Required, including name resolution
public.cdn.getdbt.com Initial installation, driver retrieval At runtime, communication stops with DBT_DISABLE_VERSION_CHECK=1
p.vx.dbt.com Telemetry (every run) Communication stops with DBT_SEND_ANONYMOUS_USAGE_STATS=false
hub.getdbt.com, codeload.github.com dbt deps (Hub packages) Only when retrieving. Not needed at runtime once retrieved

Even if telemetry and the version check are disabled, communication is still required for installation, driver retrieval, and dbt deps. If these cannot be done in the closed network, you need to retrieve them in advance in an environment that can reach the internet.

Conclusion

I tried out the steps for introducing dbt v2 in an environment close to a closed network.
I hope the content of this article is helpful to someone.


dbtの導入支援はクラスメソッドにお任せください!

クラスメソッドでは dbt の導入を支援しております。
製品の詳細や支援の内容についてお気軽にお問い合わせください。

dbtの詳細を見る

Share this article