/aws-data-analytics:testing-mwaa-workflowfrom aws-data-analytics
End-to-end testing of Amazon MWAA workflows: triggers runs for Provisioned (Python DAG via Airflow REST API) and Serverless (YAML via StartWorkflowRun), polls to completion, and on failure delegates diagnosis and fixes to companion skills before retesting.
Ships in aws-data-analytics. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
AWS MCP server (optional but recommended): running the AWS CLI commands in this skill through the AWS MCP server gives sandboxed execution and audit logging. Every command here also works with the plain AWS CLI, so the skill does not require the MCP server or any MCP-only tools.
Test Amazon MWAA workflow execution end-to-end: trigger a run, poll it to a terminal state, and on failure drive a capped debug -> fix -> retest loop. This skill triggers and reads state only; it delegates every diagnosis to debugging-mwaa-workflow and every mutation (artifact edit, redeploy, environment create/update) to authoring-mwaa-workflow. Routes by flavor, then runs one shared spine.
Execution note — poll in discrete steps: whenever you wait for an AWS operation to reach a terminal or ready state, issue one status check per call and decide in your own loop whether to check again. Never block a single command or script on the wait (no
while+sleepuntil done), regardless of the operation or how long it takes.
This skill can be loaded two ways, and they resolve the skill's own bundled files from different places. Determine how the skill was loaded before reading a reference:
retrieve_skill tool: The skill is not
installed on the local filesystem. You MUST fetch each reference via
retrieve_skill with the file parameter (e.g.
file="references/provisioned-testing.md") and read the returned content. Do
NOT file_read these paths locally — they do not exist on disk..kiro/skills/testing-mwaa-workflow/ or
~/.claude/skills/testing-mwaa-workflow/): Read the files from the local
skill directory using relative paths.This distinction applies only to the skill's own packaged files. User data and
session artifacts are always read from and written to the user's working
directory. Never fetch or write customer data through retrieve_skill.
aws mwaa get-environment -> Provisioned.workflow/... ARN or any aws mwaa-serverless context -> Serverless.dag_id, or workflow ARN) and, for a DAG, its S3 key. That
skill's approval to test satisfies the first trigger confirmation only.Confirm the artifact is deployed and parse-ready. Do not trigger blind. This step
is MANDATORY even when you plan to adopt an existing run — the readiness data
(is_active/is_stale, has_import_errors) confirms the DAG is parsed and
runnable before Step 2 decides whether to adopt a prior run.
dag_id present with has_import_errors: false,
then apply the version-aware ready check via the /dags collection endpoint.
Determine the poll window from the environment's configured scan interval:
check get-environment -> AirflowConfigurationOptions for
scheduler.dag_dir_list_interval (AF2) or dag_processor.refresh_interval (AF3).
If unset, default to 300s. Poll up to that interval + 30s at 15s intervals
(the per-DAG endpoint can lag). On AF2 (REST API v1) require
is_active: true. On AF3 (REST API v2) the is_active field does not
exist — require is_stale: false instead and never wait on is_active (it
reads as absent/false forever). A DAG that is parsed but not yet ready will
reject trigger attempts with an opaque RestApiClientException. Not ready in
time -> hand to debugging-mwaa-workflow.WorkflowStatus is READY (via get-workflow --workflow-arn). Not ready -> hand to debugging-mwaa-workflow.This readiness window is separate from the Step 3 run timeout. See references/provisioned-testing.md and references/serverless-testing.md for exact commands.
State the resolved target and classify its environment. Unless you are certain
it is a development/test environment (name or tags clearly indicate dev/test),
treat it as production: emit a prod warning and require explicit user
confirmation before triggering. If the target is confirmed production (name or
tags contain prod, prd, or production, or the user says so), require
explicit approval at every state-changing step — each trigger, re-trigger,
and clear/rerun — not just once. For a target you are certain is dev/test,
require explicit user confirmation before the first trigger and each
re-trigger.
This gate is already satisfied when the user has given explicit approval for the action: in delegated mode the caller's approval to test covers the first trigger, and an explicit pre-authorization to trigger a specific run counts as that confirmation — do not re-ask when approval has already been given.
Before triggering, apply the freshness gate to the most recent prior run
(delegated and standalone mode alike). The gate's reference time is the DAG
file's deploy time — the S3 LastModified of the DAG object — not
last_parsed_time, which advances on every re-parse even when the file has not
changed. If that deploy time cannot be read (head-object denied, or the DAG
file key unknown in standalone mode), do not fall back to last_parsed_time —
the provisioned-testing reference holds the fallback (ask for the key or deploy
time; otherwise treat every prior run as stale). Fetch the most recent run (GET /dags/<dag_id>/dagRuns, ordered
-start_date, limit 1) and decide by whether the DAG is paused, then by whether it has a schedule
(the provisioned-testing reference holds the exact commands and the per-major
fields):
last_parsed_time is after the deploy time
(within the Step 1 readiness window), then unpause. If the DAG's next run is
already due, the scheduler creates that run at once: adopt it instead of
triggering a second one. Otherwise trigger. If the parse does not come within
the window, unpause anyway and continue as for an unpaused DAG.start_date is at or after the deploy time is fresh — adopt it (non-terminal:
poll to terminal in Step 3; terminal success: report it; terminal failed:
go to Step 4). A run that started before the deploy time is stale: trigger
fresh, and if that stale run is still running handle it as the scheduled
non-terminal case below.queued/running), do not
trigger silently: ask the user to either start a fresh run now (it runs
alongside the in-flight run and can collide on downstream resources) or wait
for the in-flight run to finish first. In delegated mode the caller's
approval to test does not cover this choice — ask. If they choose to wait,
poll the in-flight run to a terminal state (it is not the test result; do not
report it as one), then trigger fresh.The gate cannot tell which code a run executed — no MWAA or Airflow API exposes a run's source, and a scheduled run can start before the new file is synced and parsed — so it decides on the deploy time and the DAG's schedule, never on the run's stored code.
On a retest, all run identifiers must be fresh (Provisioned: both
dag_run_id and logical_date; Serverless: new start-workflow-run call).
Before re-triggering, confirm every prior run is terminal — a still-running
prior run can block the new one from starting.
See references for exact trigger commands and retest hygiene.
Poll the triggered run until it reaches a terminal state. See references for exact poll commands and error fallbacks.
Timeout handling:
dagrun_timeout set: if elapsed time exceeds
dagrun_timeout and the run is still not terminal, treat as failure -> Step 4.
(dagrun_timeout is a DAG-level Airflow parameter and does not apply to MWAA
Serverless.)TIMEOUT terminal state.dagrun_timeout: there is no DAG- or service-level
deadline, so agree a maximum wait with the user before polling (they know
the DAG's expected runtime; default to 1h if they have no preference). Poll
until terminal OR the maximum wait elapses. On reaching the cap, stop polling
and report — do not silently mark it failed, and do not keep polling
unbounded:
Run
<run-id>has not reached a terminal state within the agreed<max-wait>. It may still be running — I have not failed it. Choose: (a) extend the wait, (b) inspect logs / the Airflow UI, or (c) treat this test as inconclusive.
Poll interval scales with elapsed time:
| Elapsed time | Poll interval |
|---|---|
| <= 5 min | 15s |
| > 5-15 min | 30s |
| > 15-30 min | 60s |
| > 30-60 min | 2 min |
| > 60 min | 5 min |
Pass = terminal SUCCESS only; no output-data inspection. On pass -> Step 6.
Hand the run identifiers to debugging-mwaa-workflow. It returns its standard structure (Root Cause / Impact / Immediate Fix / Prevention / Commands). Do not re-diagnose here.
5a. Classify each action item debugging returns into one bucket:
| Bucket | Examples | Handling |
|---|---|---|
| ARTIFACT | wrong operator param, missing import, bad YAML schema/timedelta, wrong task wiring, Serverless code-package fix (missing dep / wrong-platform wheel / bad zip layout) | Delegate to authoring-mwaa-workflow: regenerate the compliant artifact (and rebuild/redeploy the --code package for Serverless), then redeploy. Auto-continue. |
| ENVIRONMENT | requirements.txt dependency, plugins.zip, env config / worker sizing | Delegate to authoring's deploy path (owns env mutation + its own approval). Auto-continue after that gate. |
| HUMAN-GATED | new IAM permission, VPC/networking, missing data asset, quota increase | Cannot be auto-applied. Present exact commands, pause the loop, wait for the user to confirm resolution before any retest. |
Testing never mutates directly.
5b. Re-test. After an auto-fixable bucket is applied and redeployed, loop
back to Step 1 (redeploy triggers a fresh S3-sync/parse) -> Step 2 (re-confirm)
-> Step 3. Apply Step 2's re-trigger hygiene: fresh dag_run_id and
logical_date, and confirm the prior run is terminal (not just still
retry-backing-off) before the new trigger.
5c. Mixed action items in one cycle (parallel). Kick off the auto-fixable fixes (regenerate + redeploy via authoring) and present the human-gated items at the same time; do not fully serialize. Two guardrails: (1) gate the retest on both completing — do not re-trigger until auto-fixes are redeployed and the user confirms the human-gated items; (2) if an auto-fix depends on a human-gated item (the regenerated artifact references a resource/permission the user must create first), sequence them instead of parallelizing.
5d. Loop cap and stop conditions. The cap counts attempts without progress, not raw attempts — default 3 (override "retry up to N"). Define progress as either: a task that failed before now reaches SUCCESS (the pipeline advanced), or debugging reports a different root cause than the prior attempt. An attempt that makes progress resets the counter — a multi-task pipeline that clears one blocker per run is advancing, and a hard raw-count cap would abandon it mid-repair. Stop and summarize when any of: (1) run reaches SUCCESS -> Step 6 pass; (2) the no-progress counter hits the cap; (3) a HUMAN-GATED item -> pause for the user. Two consecutive runs with the same root cause count as one no-progress increment each — that is the counter advancing, not a separate rule.
Test Result: PASS | FAIL | STOPPED (<reason>)
Target: <env-name + dag_id | workflow ARN> [PROD WARNING if applicable]
Attempts: <n>/<cap>
Run History:
Attempt 1: <run_id> -> <state> (<duration>) [-> root cause if failed]
Fixes Applied: <artifact/env fixes auto-applied via authoring, per attempt> | none
Outstanding Action Items: <human-gated items, exact commands> | none
Next Step: <re-invoke to retest after resolving | passed, nothing needed>
PASS requires terminal SUCCESS. STOPPED covers cap-reached / no-progress / human-gated-pause, each named explicitly.
| Symptom | Cause | Action |
|---|---|---|
DAG absent from GET /dags | S3-sync lag or import error | Hand to debugging-mwaa-workflow before triggering |
RestApiClientException on poll | Airflow returned a 4xx (the web server is reachable) | Read RestApiStatusCode: 404 wrong dag_run_id, 401/403 role. Fall back to the DAGProcessing/Scheduler log groups only on RestApiServerException or a timeout |
RestApiClientException on dagRuns POST (empty message) | DAG not ready — AF2: is_active=false (activation incomplete); AF3: is_stale=true (is_active does not exist in v2) | Poll /dags collection until ready (AF2 is_active=true / AF3 is_stale=false); do not retry the trigger blind |
Manual run created but stuck in queued with start_date: null | DAG is paused; neither Airflow 2.x nor 3.x executes manual runs while paused | Unpause (PATCH /dags/<dag_id> {"is_paused": false}); the queued run then starts. Common right after an upgrade where DAGs are deployed paused |
Serverless get-workflow not READY | Still creating/updating or failed | Wait for READY; if FAILED, hand to debugging |
| Same failure two attempts running | Fix not addressing root cause | Stop at no-progress; summarize; do not burn the cap |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
mwaa-testing, dag-testing, airflow-testing, workflow-testing
21 skills in this plugin
/amazon-opensearch-serviceGuides migration, provisioning, search, log-analytics, trace-analytics, and Agentic AI Assistant workflows for Amazon OpenSearch Service and Serverless across six capabilities — migration (Solr/ES/self-managed into AOS/AOSS, schema/query translation, sizing, cutover); provisioning (domain + AOSS lifecycle, upgrades, FGAC, monitoring); search (vector / semantic / hybrid / RAG with Bedrock); log-analytics (PPL, OSI, anomaly detection, Dashboards); trace-analytics (OTel spans, service maps, Data Prepper); ai-assistant (natural language data exploration, incident investigation, root cause analysis). Triggers on OpenSearch, AOS, AOSS, Elasticsearch, Solr, vector/k-NN/semantic/hybrid search, RAG, log analytics, PPL, trace analytics, ISM, FAISS, HNSW, Migration Assistant, UltraWarm, OR1, query my data, analyze logs, investigate errors, root cause analysis./authoring-mwaa-workflowAuthors and deploys MWAA workflow artifacts: Python Airflow DAGs for provisioned environments or YAML workflow files for Serverless. Covers operator selection, timeout design, retry strategy, scheduling, failure notifications, idempotency, and MWAA Serverless schema compliance. Deploys the artifact (S3 DAG upload or Serverless CreateWorkflow/UpdateWorkflow), creates an environment inline when approved, and redeploys fixes, then optionally hands off to testing-mwaa-workflow. Triggers on: create a DAG, write a pipeline, build a workflow, orchestrate tasks, Airflow DAG, data pipeline, schedule a job, deploy a DAG, deploy a workflow, YAML workflow. Not applicable to converting or migrating existing DAGs between provisioned and serverless (conversion is out of scope), running or smoke-testing a deployed workflow (handled by testing-mwaa-workflow) or diagnosing a failed run (handled by debugging-mwaa-workflow).
npx claudepluginhub aws/agent-toolkit-for-aws --plugin aws-data-analyticsOther plugins' skills for the same job