$npx -y skills add astronomer/agents --skill managing-astro-deploymentsManage Astronomer production deployments with Astro CLI. Use when the user wants to authenticate, switch workspaces, create/update/delete deployments, or deploy code to production.
| 1 | # Astro Deployment Management |
| 2 | |
| 3 | This skill helps you manage production Astronomer deployments using the Astro CLI. |
| 4 | |
| 5 | > **For local development**, see the **managing-astro-local-env** skill. |
| 6 | > **For production troubleshooting**, see the **troubleshooting-astro-deployments** skill. |
| 7 | |
| 8 | --- |
| 9 | |
| 10 | ## Authentication |
| 11 | |
| 12 | All deployment operations require authentication: |
| 13 | |
| 14 | ```bash |
| 15 | # Login to Astronomer (opens browser for OAuth) |
| 16 | astro login |
| 17 | ``` |
| 18 | |
| 19 | Authentication tokens are stored locally for subsequent commands. Run this before any deployment operations. |
| 20 | |
| 21 | --- |
| 22 | |
| 23 | ## Workspace Management |
| 24 | |
| 25 | Deployments are organized into workspaces: |
| 26 | |
| 27 | ```bash |
| 28 | # List all accessible workspaces |
| 29 | astro workspace list |
| 30 | |
| 31 | # Switch to a specific workspace |
| 32 | astro workspace switch <WORKSPACE_ID> |
| 33 | ``` |
| 34 | |
| 35 | Workspace context is maintained between sessions. Most deployment commands operate within the current workspace context. |
| 36 | |
| 37 | --- |
| 38 | |
| 39 | ## List and Inspect Deployments |
| 40 | |
| 41 | ```bash |
| 42 | # List deployments in current workspace |
| 43 | astro deployment list |
| 44 | |
| 45 | # List deployments across all workspaces |
| 46 | astro deployment list --all |
| 47 | |
| 48 | # Inspect specific deployment (detailed info) |
| 49 | astro deployment inspect <DEPLOYMENT_ID> |
| 50 | |
| 51 | # Inspect by name (alternative to ID) |
| 52 | astro deployment inspect --deployment-name data-service-stg |
| 53 | ``` |
| 54 | |
| 55 | ### What `inspect` Shows |
| 56 | |
| 57 | - Deployment status (HEALTHY, UNHEALTHY) |
| 58 | - Runtime version and Airflow version |
| 59 | - Executor type (CELERY, KUBERNETES, LOCAL) |
| 60 | - Scheduler configuration (size, count) |
| 61 | - Worker queue settings (min/max workers, concurrency, worker type) |
| 62 | - Resource quotas (CPU, memory) |
| 63 | - Environment variables |
| 64 | - Last deployment timestamp and current tag |
| 65 | - Webserver and API URLs |
| 66 | - High availability status |
| 67 | |
| 68 | --- |
| 69 | |
| 70 | ## Create Deployments |
| 71 | |
| 72 | ```bash |
| 73 | # Create with default settings |
| 74 | astro deployment create |
| 75 | |
| 76 | # Create with specific executor |
| 77 | astro deployment create --label production --executor celery |
| 78 | astro deployment create --label staging --executor kubernetes |
| 79 | |
| 80 | # Executor options: |
| 81 | # - celery: Best for most production workloads |
| 82 | # - kubernetes: Best for dynamic scaling, isolated tasks |
| 83 | # - local: Best for development only |
| 84 | ``` |
| 85 | |
| 86 | --- |
| 87 | |
| 88 | ## Update Deployments |
| 89 | |
| 90 | ```bash |
| 91 | # Enable DAG-only deploys (faster iteration) |
| 92 | astro deployment update <DEPLOYMENT_ID> --dag-deploy-enabled |
| 93 | |
| 94 | # Update other settings (use --help for full options) |
| 95 | astro deployment update <DEPLOYMENT_ID> --help |
| 96 | ``` |
| 97 | |
| 98 | --- |
| 99 | |
| 100 | ## Delete Deployments |
| 101 | |
| 102 | ```bash |
| 103 | # Delete a deployment (requires confirmation) |
| 104 | astro deployment delete <DEPLOYMENT_ID> |
| 105 | ``` |
| 106 | |
| 107 | **Destructive**: This cannot be undone. All DAGs, task history, and metadata will be lost. |
| 108 | |
| 109 | --- |
| 110 | |
| 111 | ## Deploy Code to Production |
| 112 | |
| 113 | ### Full Deploy |
| 114 | |
| 115 | Deploy both DAGs and Docker image (required when dependencies change): |
| 116 | |
| 117 | ```bash |
| 118 | astro deploy <DEPLOYMENT_ID> |
| 119 | ``` |
| 120 | |
| 121 | Use when: |
| 122 | - Dependencies changed (`requirements.txt`, `packages.txt`, `Dockerfile`) |
| 123 | - First deployment of new project |
| 124 | - Significant infrastructure changes |
| 125 | |
| 126 | ### DAG-Only Deploy (Recommended for Iteration) |
| 127 | |
| 128 | Deploy only DAG files, skip Docker image rebuild: |
| 129 | |
| 130 | ```bash |
| 131 | astro deploy <DEPLOYMENT_ID> --dags |
| 132 | ``` |
| 133 | |
| 134 | Use when: |
| 135 | - Only DAG files changed (Python files in `dags/` directory) |
| 136 | - Quick iteration during development |
| 137 | - Much faster than full deploy (seconds vs minutes) |
| 138 | |
| 139 | **Requires**: `--dag-deploy-enabled` flag set on deployment (see Update Deployments) |
| 140 | |
| 141 | ### Image-Only Deploy |
| 142 | |
| 143 | Deploy only Docker image, skip DAG sync: |
| 144 | |
| 145 | ```bash |
| 146 | astro deploy <DEPLOYMENT_ID> --image-only |
| 147 | ``` |
| 148 | |
| 149 | Use when: |
| 150 | - Only dependencies changed |
| 151 | - Dockerfile or requirements updated |
| 152 | - No DAG changes |
| 153 | |
| 154 | ### Force Deploy |
| 155 | |
| 156 | Bypass safety checks and deploy: |
| 157 | |
| 158 | ```bash |
| 159 | astro deploy <DEPLOYMENT_ID> --force |
| 160 | ``` |
| 161 | |
| 162 | **Caution**: Skips validation that could prevent broken deployments. |
| 163 | |
| 164 | --- |
| 165 | |
| 166 | ## Deployment API Tokens |
| 167 | |
| 168 | Manage API tokens for programmatic access to deployments: |
| 169 | |
| 170 | ```bash |
| 171 | # List tokens for a deployment |
| 172 | astro deployment token list --deployment-id <DEPLOYMENT_ID> |
| 173 | |
| 174 | # Create a new token |
| 175 | astro deployment token create \ |
| 176 | --deployment-id <DEPLOYMENT_ID> \ |
| 177 | --name "CI/CD Pipeline" \ |
| 178 | --role DEPLOYMENT_ADMIN |
| 179 | |
| 180 | # Create token with expiration |
| 181 | astro deployment token create \ |
| 182 | --deployment-id <DEPLOYMENT_ID> \ |
| 183 | --name "Temporary Access" \ |
| 184 | --role DEPLOYMENT_ADMIN \ |
| 185 | --expiry 30 # Days until expiration (0 = never expires) |
| 186 | ``` |
| 187 | |
| 188 | **Roles**: |
| 189 | - `DEPLOYMENT_ADMIN`: Full access to deployment |
| 190 | |
| 191 | **Note**: Token value is only shown at creation time. Store it securely. |
| 192 | |
| 193 | --- |
| 194 | |
| 195 | ## Common Workflows |
| 196 | |
| 197 | ### First-Time Production Deployment |
| 198 | |
| 199 | ```bash |
| 200 | # 1. Login |
| 201 | astro login |
| 202 | |
| 203 | # 2. Switch to production workspace |
| 204 | astro workspace list |
| 205 | astro workspace switch <PROD_WORKSPACE_ID> |
| 206 | |
| 207 | # 3. Create deployment |
| 208 | astro deployment create --label production --executor celery |
| 209 | |
| 210 | # 4. Note the deployment ID, then deploy |
| 211 | astro deploy <DEPLOYMENT_ID> |
| 212 | ``` |
| 213 | |
| 214 | ### Iterative DAG Development |
| 215 | |
| 216 | ```bash |
| 217 | # 1. Enable fast deploys (one-time |