Connections & Hooks

Airflow is often used to pull and push data into other systems, and so it has a first-class Connection concept for storing credentials that are used to talk to external systems.

A Connection is essentially set of parameters - such as username, password and hostname - along with the type of system that it connects to, and a unique name, called the conn_id.

They can be managed via the UI or via the CLI; see Managing Connections for more information on creating, editing and managing connections. There are customizable connection storage and backend options.

You can use Connections directly from your own code, you can use them via Hooks or use them from templates:

echo {{ conn.<conn_id>.host }}


A Hook is a high-level interface to an external platform that lets you quickly and easily talk to them without having to write low-level code that hits their API or uses special libraries. They’re also often the building blocks that Operators are built out of.

They integrate with Connections to gather credentials, and many have a default conn_id; for example, the PostgresHook automatically looks for the Connection with a conn_id of postgres_default if you don’t pass one in.

You can view a full list of airflow hooks in our API documentation.

Custom connections

Airflow allows to define custom connection types. This is what is described in detail in Provider packages - providers give you the capability of defining your own connections. The connection customization can be done by any provider, but also many of the providers managed by the community define custom connection types. The full list of all providers delivered by Apache Airflow community managed providers can be found in Connections.

Was this entry helpful?