starship-usage
You might have defined Airflow connections and variables in the following places on your source Airflow environment:
- The Airflow UI (stored in the Airflow metadata database).
- Environment variables
- A secrets backend.
If you defined your Airflow variables and connections in the Airflow UI, you can migrate those to Astro with Starship. You can check which resources will be migrated by going to Admin > Variables and Admin > Connections in the Airflow UI to find your source Airflow environment information.
Some environment variables or Airflow Settings, like global environment variable values, can't be migrated to Astro. See Global environment variables for a list of variables that you can't migrate to Astro.
- Starship Plugin
- Starship operator
In the Airflow UI for your source Airflow environment, go to Astronomer > Migration Tool ๐.
Click Get Token.
If required, log in to cloud.astronomer.io.
Copy the access token that appears after logging in.
In the Migration Tool ๐ page of the Airflow UI, paste the access token into the Authentication Token field.
Click Sign in.
In the Target Deployment menu, select the Deployment where you want to migrate your Airflow variables and connections, then click Select.
Click Connections. In the table that appears, click Migrate for each connection that you want to migrate to Astro. After the migration is complete, the status Migrated โ appears.
Click Variables.
In the table that appears, click Migrate for each variable that you want to migrate to Astro. After the migration is complete, the status Migrated โ appears.
Click Environment variables.
In the table that appears, check the box for each environment variable that you want to migrate to Astro, then click Migrate. After the migration is complete, the status Migrated โ appears.
Refer to the Configuration detailed instructions on using the operator.
Add the following DAG to your source Airflow environment:
from airflow import DAG
from astronomer.starship.operators import AstroMigrationOperator
from datetime import datetime
with DAG(
dag_id="astronomer_migration_dag",
start_date=datetime(1970, 1, 1),
schedule_interval=None,
) as dag:
AstroMigrationOperator(
task_id='export_meta',
deployment_url='{{ dag_run.conf["deployment_url"] }}',
token='{{ dag_run.conf["astro_token"] }}',
)Deploy this DAG to your source Airflow environment.
Once the DAG is available in the Airflow UI, click Trigger DAG, then click Trigger DAG w/ config.
In Configuration JSON, add the following configuration:
{
"deployment_url": "<your-deployment-url>",
"astro_token": "<your-astro-token>"
}Replace the following placeholder values:
<your-deployment-url>
: To retrieve a deployment URL, open your Astro Airflow Deployment in the Cloud UI, click Open Airflow, and copy the Airflow UI URL excluding/home
on the end of the URL. For example, if your deployment URL ishttps://astronomer.astronomer.run/abcdt4ry/home
, you would enterhttps://astronomer.astronomer.run/abcdt4ry
.<your-astro-token>
: To retrieve an Astronomer token, go to cloud.astronomer.io/token and log in using your Astro credentials. After you log in, copy the token that appears and paste it as the value.
Click Trigger. After the DAG successfully runs, all connections, variables, and environment variables that are available from the Airflow UI are migrated to Astronomer.