Amazon MWAA ExecModule
Overview
AwsMwaaModule reads Apache Airflow inventory and run history from one Amazon Managed Workflows for Apache Airflow (MWAA) environment. A workflow can discover available directed acyclic graphs (DAGs), check whether one is paused, and route run states into a readiness check, report, or incident workflow.
The module uses the AWS-signed MWAA InvokeRestApi operation with a fixed Airflow GET path. It reads one page at a time. It cannot trigger, pause, clear, retry, or modify Airflow runs or DAGs.
Usage
- Create a verified,
READYAmazon MWAA connection in the Integration Account Console. - In Workflow Studio, add Amazon MWAA and choose the account under General > Connection.
- Set the AWS region and exact MWAA environment name. Use
list_dagsto find the DAG ID, then pass that ID tolist_dag_runs. - Save the operation and target on each step. Leave the run step’s DAG ID unset to map it from a discovery result.
- Route the normalized records to a decision or reporting step. Treat errors, an empty page, and an unsuccessful run as distinct outcomes.
Inputs
| Input | Type | Required | Default | Purpose |
|---|---|---|---|---|
operation | string | Yes | — | list_dags or list_dag_runs. |
region | string | Yes | — | AWS region that hosts the environment, for example us-west-2. |
environmentName | string | Yes | — | Exact Amazon MWAA environment name. |
dagId | string | For run history | — | Airflow DAG identifier, up to 50 characters from letters, digits, underscore, dot, and hyphen. |
limit | integer | No | 25 | Records per page, from 1 to 100. |
offset | integer | No | 0 | Page offset, from 0 to 1,000,000. |
Outputs
| Output | Meaning |
|---|---|
status / operation | Result status and selected operation. |
items / count | Normalized records and the number on this page. |
totalEntries | Provider count for the collection. |
hasMore / nextOffset | Page continuation information. Use the returned offset for the next read. |
requestId | AWS request ID when available. |
error | Stable code, redacted message, HTTP status, and a retryability hint on failure. |
A DAG summary includes its dagId, pause state isPaused, and active state isActive when present. A run summary includes dagId, dagRunId, state, and available logicalDate, startDate, and endDate. Treat missing timestamps as unknown. Provider payloads, run configuration, task logs, and Airflow variables are excluded.
IntegrationAccount Requirements
Use the Amazon MWAA connection template, keep the account name set to AWS, and verify the account before use. Put the AWS access key ID in the API key field and the secret access key in the protected password field. The runtime resolves both through the selected account. The connector uses this key pair and supports standard regional endpoints.
Scope IAM permission to airflow:InvokeRestApi for the selected environment's Airflow Viewer role. For private webservers accessed over the public internet, AWS also requires airflow:CreateWebLoginToken. Check the MWAA access policy examples for the ARN format and network requirements. Keep a dedicated monitoring identity and limit who can access workflow run results.
Configuration
Use an MWAA environment running Airflow 2.4.3 or a later Airflow 2 release that supports both REST collections. Verify the operations in your environment before using the results to gate a downstream action. Use a separate account binding and step when monitoring a different AWS account or region.
Operations
list_dagsreads the active DAGs visible to the selected identity using the Airflow defaults. Use the returned IDs and pause states to check inventory.list_dag_runsreads the run collection for one DAG, ordered by descending execution date. Use the run state and available timestamps to evaluate freshness and failure.
Errors and Failure Modes
- A malformed input or unready connection fails before contacting AWS. Correct the field or reverify the connection.
- Authorization failures require checking both the AWS IAM policy and the Airflow role. A missing DAG or environment calls for checking the region and identifiers.
- Throttling, timeouts, and service errors can be transient. Use the retryability hint and schedule any workflow retry with bounded backoff.
- An invalid provider response is reported as an error. Route it separately from a successful page with zero rows.
Example
For a morning warehouse readiness check, read the run history for the warehouse_daily DAG in the production-airflow environment.
{
"operation": "list_dag_runs",
"region": "us-west-2",
"environmentName": "production-airflow",
"dagId": "warehouse_daily",
"limit": 10
}
Expect a page of up to ten run summaries. A downstream step can compare each run's available date with the expected reporting window and require a success state before continuing. Send failures to an incident step and handle running, missing, and stale observations according to your own readiness policy.
Notes
- Reads are safe to repeat. The module makes no Airflow changes. Concurrent runs can shift offset-based pages, so deduplicate by DAG and run ID if traversing history.
- The 50-character DAG ID bound keeps the request path within AWS's 64-character limit. Exact run lookup, task-instance details, and management actions are outside this interface.
- Respect MWAA's documented service quotas, including the REST request time and response-size limits. Prefer small pages and stagger scheduled reads across environments.