Resource overview
Connect to databases, APIs, and other external systems.
Resources in Airplane allow you to easily configure connections to external systems like databases
and APIs and use them in your tasks and runbooks.
To create and manage resources, you must be a team admin.
Visit Resources in the app to add a new resource.
Supported resources
Supported resources
For details on using each resource, refer to its specific documentation.
Managed Databases
Managed Databases
Databases
Databases
APIs
APIs
Messaging
Messaging
Don't see what you're looking for? Let us know by emailing
hello@airplane.dev—we're constantly adding resources based on feedback!
Using resources in tasks
Using resources in tasks
Resources can be attached to tasks and referenced from within the task.
SQL
SQL
When creating a SQL task you can choose a database resource to query against. The database is chosen
from the UI or set in the task definition.
REST
REST
When you create a REST task, you can select a REST API. The REST API's base URL will be used, as
well as any headers specified on the resource.
The REST API is chosen from the UI or set in the task definition.
JavaScript, Python, and other tasks
JavaScript, Python, and other tasks
Resource attachment
Resource attachment
Resources must be attached to tasks before they can be accessed via environment variables or
built-ins.
typescriptCopied1export default airplane.task(2{3slug: "my_task",4resources: {5// Where backend_db is the slug of a resource.6db: "backend_db"7},8},9async () => {...}10);
pythonCopied1@airplane.task(2resources=[3airplane.Resource(4alias="db",5# Where backend_db is the slug of a resource.6slug="backend_db",7),8],9)10def my_task():11pass
In your task definition file (the file with extension
.task.yaml
):yamlCopied1resources:2# Where backend_db is the slug of a resource.3db: backend_db
Navigate to the task's build settings. You'll see a Resources section which will allow you to
provide an alias for the resource that you select via the dropdown. The alias will default to the
resource's slug but can be changed.

Environment variables
Environment variables
When attached to a task, resources are passed as a JSON-encoded string via the environment variable
AIRPLANE_RESOURCES
. This contains a mapping of resource alias to a resource object. For more
information, see the Resource environment variables reference.Built-ins
Built-ins
The JavaScript and Python SDKs offer built-in functions for common operations
against resources. Once a resource is attached to a task, you can refer to the resource by alias in
the built-in.
For example, after attaching the SQL resource with slug
db
, you can refer to it using a built-in
to query the SQL database:typescriptCopied1const run = await airplane.sql.query<{ id: string; name: string; email: string }>(2"db", // Attached resource3"select * from users where name ilike :name", // SQL query to execute4{ args: { name: `%${name}%` } }, // Query arguments5);
pythonCopied1run = airplane.sql.query(2sql_resource="db", # Attached resource3query="select * from users where name ilike :name",4query_args={"name": f"%{params['name']}%"}5)
Using resources in multiple environments
Using resources in multiple environments
Resources can be used in other environments by
promoting them.
For example, say you have a Postgres database named
postgres_db
that you want to use in multiple
environments. In Airplane, all resources must have a unique slug, even across environments. To use
the same resource slug across multiple enviroments, you
promote the resource from one environment to
another.When you promote a resource from one environment to another, the task slug remains the same, and you
can update the resource's configuration that is specific to that environment.
For example, say you have a different database in your
staging
environment than your production
environment. By promoting the resource, in this
case from staging
to production
, the resource will have the same slug across both environments.
Airplane will then choose the correct resource for the environment your task is currently runnning
in.See promoting between environments for more
info.
Using resources in runbooks
Using resources in runbooks
Resources can be used in blocks within runbooks.
For example, once a database resource like Postgres has been configured, you can add a SQL block and
run queries using it:

That's all you have to do—Airplane will handle securely passing the connection information to the
agent running the query.