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.
For details on using each resource, refer to its specific documentation.
Using resources in tasks
Resources can be attached to tasks and referenced from within the task.
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.
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.
Node.js, Python, and other tasks
Resources can be attached to tasks and then accessed through environment variables or built-ins. The resource must be explicitly attached via the UI or task definition.
To attach resources via the UI, 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.
When attached to a task, resources are passed as a map of alias to resource configuration in the JSON environment variable
AIRPLANE_RESOURCES. The exact resource configuration fields depend on the resource kind and are documented in each resource's reference page.
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.