You can configure Deployments programmatically using Deployment files and Deployment template files. Deployment files are used to update the same Deployment programmatically, and Deployment template files are used to create new Deployments based on a single template.
Managing Deployments with files is essential to automating Deployment management at scale. For example, you can:
Use this document to learn how to create and manage Deployment files and Deployment template files. See the Deployment file reference for a list of configurable Deployment file values. When you’re ready to programmatically run Deployment file workflows, see Authenticate your workflow.
To create a template file based on an existing Deployment, run the following command:
To create a Deployment file based on an existing Deployment, run the following command:
Alternatively, you can manually create a template file without using an existing Deployment as explained in Create a Deployment using a template file.
yaml file:Note that for Deployments on a standard cluster, the region and cluster-name parameters must both contain the region name for the standard cluster. See Available regions for your cloud provider.
Adjust the template file values for the Deployment you want to create. When working with template files, keep the following in mind:
The name field must include a unique name within the Workspace.
The workspace_name field must include a valid Workspace name that exists in your Astro Organization.
The possible values for cloud_provider, executor, and scheduler_size are the same possible values when you create a Deployment with astro deployment create.
See Airflow and Astro Runtime version parity to choose your Astro Runtime version.
See Deployment file reference for a list of all configurable Deployment template file values.
Run the following command to create the Deployment:
(Optional) Either open the Astro UI or run the following command to confirm that you successfully created your Deployment:
(Optional) Reconfigure any Airflow connections or variables from the Deployment that you copied into the template file. Airflow connections and variables cannot be configured using template files. See Manage connections in Airflow.
A Deployment file is a complete snapshot of an existing Deployment at the point you inspected it. It’s similar to a template file, but also contains your Deployment’s name, description, and metadata. In the same way you use a template file to create a new Deployment, you use a Deployment file to update an existing Deployment with a new set of configurations.
When you update a Deployment with a Deployment file, keep the following in mind:
value to your Deployment file. To redeploy using the Deployment file, you either need to provide the value again in the Deployment file or delete the object for the variable. Otherwise, astro deployment create will fail. See deployment.environment_variables for more details.To update a Deployment using a Deployment file:
Modify the Deployment file and save your changes. See Deployment file reference for fields that you can modify.
Update your Deployment according to the configurations in the Deployment file: