AWS today announced Amazon Managed Workflows for Apache Airflow (MWAA) Serverless. This is a new deployment option for MWAA that eliminates the operational overhead of managing an Apache Airflow environment while optimizing costs through serverless scaling. This new offering addresses key challenges facing data engineers and DevOps teams in orchestrating workflows: operational scalability, cost optimization and access management.
With MWAA Serverless, you can focus on your workflow logic rather than monitoring provisioned capacity. Now you can submit your Airflow workflows to run on a schedule or on demand, paying only for the actual compute time used during the execution of each job. The service automatically handles all infrastructure scaling so your workflows run efficiently regardless of load.
In addition to simplified operations, MWAA Serverless introduces an updated security model for granular control through AWS Identity and Access Management (IAM). Each workflow can now have its own IAM permissions and run on a VPC of your choice, so you can implement precise security controls without creating separate Airflow environments. This approach significantly reduces security management overhead while strengthening your security posture.
In this post, we demonstrate how to use MWAA Serverless to build and deploy scalable workflow automation solutions. We’ll walk through hands-on examples of creating and deploying workflows, setting up observability through Amazon CloudWatch, and converting existing Apache Airflow Directed Acyclic Graphs (DAGs) to a serverless format. We’ll also explore best practices for managing serverless workflows and show you how to implement monitoring and logging.
How does MWAA Serverless work?
MWAA Serverless takes your workflow definitions and efficiently runs them in service-managed Airflow environments, automatically scaling resources based on workflow requirements. MWAA Serverless uses an Amazon Elastic Container Service (Amazon ECS) executor to run each individual job on its own ECS Fargate container, either in your VPC or a VPC managed by the service. These containers then communicate back to their assigned Airflow cluster using the Airflow 3 Task API.
Figure 1: Amazon MWAA architecture
MWAA Serverless uses declarative YAML configuration files based on the popular open source DAG Factory format to increase security through job isolation. You have two options for creating these workflow definitions:
This declarative approach provides two key advantages. First, because MWAA Serverless reads workflow definitions from YAML, it can determine job scheduling without running any workflow code. Second, it allows MWAA Serverless to grant execution permissions only when jobs are launched, rather than requiring broad permissions at the workflow level. The result is a more secure environment where task permissions are strictly defined and time-limited.
Service Aspects for MWAA Serverless
MWAA Serverless has the following limitations that you should consider when deciding between serverless and provisioned MWAA deployments:
- Operator support
- MWAA Serverless only supports carriers from the Amazon Provider Package.
- To run your own code or scripts, you’ll need to use AWS services such as:
- User interface
- MWAA Serverless works without using the Airflow web interface.
- We provide integration with Amazon CloudWatch and AWS CloudTrail for workflow monitoring and management.
Working with MWAA Serverless
To use MWAA Serverless, please complete the following prerequisites and steps.
Prerequisites
Before you begin, verify that you meet the following requirements:
- Access and permissions
- An AWS account
- Installed and configured AWS Command Line Interface (AWS CLI) version 2.31.38 or later
- Appropriate permissions to create and edit IAM roles and policies, including the following required IAM permissions:
airflow-serverless:CreateWorkflowairflow-serverless:DeleteWorkflowairflow-serverless:GetTaskInstanceairflow-serverless:GetWorkflowRunairflow-serverless:ListTaskInstancesairflow-serverless:ListWorkflowRunsairflow-serverless:ListWorkflowsairflow-serverless:StartWorkflowRunairflow-serverless:UpdateWorkflowiam:CreateRoleiam:DeleteRoleiam:DeleteRolePolicyiam:GetRoleiam:PutRolePolicyiam:UpdateAssumeRolePolicylogs:CreateLogGrouplogs:CreateLogStreamlogs:PutLogEventsairflow:GetEnvironmentairflow:ListEnvironmentss3:DeleteObjects3:GetObjects3:ListBuckets3:PutObjects3:Sync
- Access to Amazon Virtual Private Cloud (VPC) with Internet connection
- Required AWS Services β In addition to MWAA Serverless, you will need access to the following AWS services:
- Amazon MWAA to access your existing Airflow environments
- Amazon CloudWatch to view logs
- Amazon S3 for managing DAG and YAML files
- AWS IAM for authorization control
- Development environment
- Additional requirements
- Basic knowledge of Apache Airflow concepts
- Understanding YAML syntax
- Knowledge of AWS CLI commands
Note: We use sample values ββin this post, which you will need to replace with your own:
- Replace
amzn-s3-demo-bucketwith the name of your S3 group - Replace
111122223333with your AWS account number - Replace
us-east-2with your AWS Region. MWAA Serverless is available in multiple AWS regions. See the list of available AWS services by region for current availability.
Create your first serverless workflow
Let’s start by defining a simple workflow that gets a list of S3 objects and writes that list to a file in the same bucket. Create a new file named simple_s3_test.yaml with the following content:
In order for this workflow to run, you must create a launch role that has dump and write permissions to the bucket above. The role must also be taken from MWAA Serverless. The following CLI commands create this role and associated policies:
You then copy your YAML DAG to the same S3 bucket and create your workflow based on Arn’s response from the function above.
The output of the last statement returns a WorkflowARN value, which you then use to trigger the workflow:
The output returns a RunId a value that you then use to check the running status of the workflow you just executed.
If you need to make a change to your YAML, you can copy it back to S3 and run it update-workflow command.
Converting Python DAGs to YAML format
AWS has published a conversion tool that uses the open-source Airflow DAG processor to serialize Python DAGs into a YAML DAG factory format. To install, run the following:
For example, create the following DAG and name it create_s3_objects.py:
Once you install python-to-yaml-dag-converter-mwaa-serverlessyou run:
Where the output ends:
And the resulting YAML will look like this:
Note that since the YAML conversion is done after the DAG is parsed, a loop is first run to create the tasks, and the resulting static list of tasks is written to a YAML document with their dependencies.
DAG migration of MWAA environment to MWAA Serverless
You can leverage MWAA’s provisioned environment to develop and test your workflows, then move them to serverless to run efficiently at scale. Additionally, if your MWAA environment uses compatible MWAA Serverless operators, you can convert all DAG environments at once. The first step is to enable MWAA Serverless to assume the role of MWAA Execution through a trust relationship. This is a one-time operation for each MWAA Execution role and can be done manually in the IAM console or using the AWS CLI command as follows:
We can now loop through each successfully converted DAG and create serverless workflows for each.
To see a list of created workflows, run:
Monitoring and observability
The execution status of the MWAA Serverless workflow is returned via GetWorkflowRun function. The results from this will return the details for that particular run. If there are errors in the workflow definition, they are returned under RunDetail in ErrorMessage field as in the following example:
Workflows that are correctly defined but whose tasks fail will roll back "ErrorMessage": "Workflow execution failed":
MWAA Serverless job logs are stored in the CloudWatch log group /aws/mwaa-serverless/ (where / is the same string as the unique workflow ID in the workflow ARN). For specific job log streams, you will need to list the jobs for the workflow to run and then get information about each job. You can combine these operations into a single CLI command.
Which would result in the following:
At this point you would use CloudWatch LogStream output for debugging your workflow.
You can view and manage your workflows in the Amazon MWAA Serverless console:

For an example that creates detailed metrics and a monitoring dashboard using AWS Lambda, Amazon CloudWatch, Amazon DynamoDB, and Amazon EventBridge, see the example in this GitHub repository.
Clean up the resources
To avoid ongoing charges, clean up all resources created during this course by following these steps:
- Delete MWAA Serverless Workflows – Run this AWS CLI command to delete all workflows:
- Remove the IAM roles and policies created for this course:
- Remove the YAML workflow definitions from your S3 bucket:
After completing these steps, verify in the AWS Management Console that all resources were removed correctly. Note that CloudWatch logs are kept by default and may need to be deleted separately if you want to delete all traces after running a workflow.
If you encounter any errors during the cleanup, verify that you have the necessary permissions and resources before attempting to remove them. Some resources may have dependencies that require them to be removed in a certain order.
Conclusion
In this post, we explored Amazon MWAA Serverless, a new deployment option that simplifies Apache Airflow workflow management. We’ve shown how to create workflows using YAML definitions, convert existing Python DAGs to a serverless format, and monitor your workflows.
MWAA Serverless offers several key benefits:
- No provisioning overhead
- Pay-as-you-go pricing model
- Auto-scaling based on workflow requirements
- Improved security with granular IAM permissions
- Simplified definition of workflows using YAML
For more information about MWAA Serverless, see the documentation.
About the authors