Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active February 4, 2021 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garystafford/d0b5fce6810d3d7b7d38eb76d8c3ac43 to your computer and use it in GitHub Desktop.
Save garystafford/d0b5fce6810d3d7b7d38eb76d8c3ac43 to your computer and use it in GitHub Desktop.
ENVIRONMENT_NAME=$(aws mwaa list-environments | jq -r '.Environments | .[]')
DAG_NAME="multiple_steps"
CONFIG="""'{
\"airflow_email\": \"analytics_team@example.com\",
\"email_on_failure\": true,
\"email_on_retry\": false
}'"""
CLI_JSON=$(aws mwaa create-cli-token --name ${ENVIRONMENT_NAME}) \
&& CLI_TOKEN=$(echo $CLI_JSON | jq -r '.CliToken') \
&& WEB_SERVER_HOSTNAME=$(echo $CLI_JSON | jq -r '.WebServerHostname') \
curl --request POST "https://${WEB_SERVER_HOSTNAME}/aws_mwaa/cli" \
--header "Authorization: Bearer ${CLI_TOKEN}" \
--header "Content-Type: text/plain" \
--data-raw "trigger_dag ${DAG_NAME} --conf ${CONFIG}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment