Trigger AWS MWAA (Airflow) DAGs from Retool


I am trying to configure a button in a Retool dashboard that will trigger a DAG in AWS MWAA.

Unfortunately, AWS MWAA doesn't support the airflow API—I have to send the triggers using the AWS cli API (see the "Add a configuration when triggering a DAG" section in their docs). I can make a post request to trigger the DAG, but this requires creating an AWS cli token (that is only valid for 60 seconds). So essentially, the button in my dashboard would need to trigger:

  • creating CLI token
  • sending POST request to AWS CLI to trigger the DAG (within 60 seconds)

This doesn't seem reasonable to manage using RESTQuery resource (because I wouldn't have a valid CLI token) or the Run JS Code resource (because I'd have to import the aws library etc. and I'd have to hardcode the access keys and such since I can't access secrets in the query box).

Is there a better way to go about this? I'm wondering both from the perspective of triggering DAGs in AWS MWAA and managing/creating CLI tokens more generally for use in dashboards.

Hi @r0han,
This may be easiest by creating an AWS Lambda or your own server that do both (1) call AWS to create cli token and (2) trigger the DAG.

Alternatively, maybe you can create a workflow with Python script that does that for you:

Hopefully one day we can call Python from an app!