Sunday, June 15, 2025

Finest practices for upgrading Amazon MWAA environments

Amazon Managed Workflows for Apache Airflow (Amazon MWAA) has grow to be a cornerstone for organizations embracing data-driven decision-making. As a scalable resolution for managing complicated knowledge pipelines, Amazon MWAA permits seamless orchestration throughout AWS providers and on-premises programs. Though AWS manages the underlying infrastructure, you need to rigorously plan and execute your Amazon MWAA atmosphere updates in accordance with the shared accountability mannequin. Upgrading to the newest Amazon MWAA model can present vital benefits, together with enhanced safety via essential safety patches and potential enhancements in efficiency with quicker DAG parsing and lowered database load. You should use superior options whereas sustaining ecosystem compatibility and receiving prioritized AWS help. The important thing to profitable upgrades lies in selecting the best resolution and following a methodical implementation method.

On this submit, we discover greatest practices for upgrading your Amazon MWAA atmosphere and supply a step-by-step information to seamlessly transition to the newest model.

Answer overview

Amazon MWAA gives two major improve options:

  • In-place improve – This methodology works greatest when you possibly can accommodate deliberate downtime. You deploy the brand new model straight in your current infrastructure. In-place model upgrades on Amazon MWAA are supported for environments working Apache Airflow model 2.x and later. Nevertheless, for those who’re working model 1.10.z or older variations, you need to create a brand new atmosphere and migrate your sources, as a result of these variations don’t help in-place upgrades.
  • Cutover improve – This methodology helps decrease disruption to manufacturing environments. You create a brand new Amazon MWAA atmosphere with the goal model after which transition out of your previous atmosphere to the brand new one.

Every resolution affords a distinct method that will help you improve whereas working to take care of knowledge integrity and system reliability.

In-place improve

In-place upgrades work properly for environments the place you possibly can schedule a upkeep window for the improve course of. Throughout this window, Amazon MWAA preserves your workflow historical past. This methodology works greatest when you possibly can accommodate deliberate downtime. It helps preserve historic knowledge, gives an easy improve course of, and consists of rollback capabilities if points happen throughout provisioning. You additionally use fewer sources since you don’t must create a brand new atmosphere.

You possibly can carry out in-place upgrades via the AWS Administration Console with a single operation. This course of helps cut back operational overhead by managing many improve steps for you.

In the course of the improve course of, your atmosphere can’t schedule or run new duties. Amazon MWAA helps handle the improve course of and implements security measures—if points happen in the course of the provisioning part, the service makes an attempt to revert to the earlier secure model.

Earlier than you start an in-place improve, we suggest testing your DAGs for compatibility with the goal model, as a result of DAG compatibility points can have an effect on the improve course of. You should use the Amazon MWAA native runner to check DAG compatibility earlier than you begin the improve. You can begin the improve utilizing both the console and specifying the brand new model or the AWS Command Line Interface (AWS CLI). The next is an instance Amazon MWAA improve command utilizing the AWS CLI:

aws mwaa update-environment --name  --airflow-version 

The next diagram reveals the Amazon MWAA in-place improve workflow and states.

In-place upgrade workflow and states

Consult with Introducing in-place model upgrades with Amazon MWAA for extra particulars.

Cutover improve

A cutover improve gives another resolution when you want to decrease downtime, although it requires extra handbook steps and operational planning. With this method, you create a brand new Amazon MWAA atmosphere, migrate your metadata, and handle the transition between environments. Though this methodology affords extra management over the improve course of, it requires extra planning and execution effort in comparison with an in-place improve.

This methodology can work properly for environments with complicated workflows, notably if you plan to make vital adjustments alongside the model improve. The method affords a number of advantages: you possibly can decrease manufacturing downtime, carry out complete testing earlier than switching environments, and preserve the flexibility to return to your unique atmosphere if wanted. You too can assessment and replace your configurations in the course of the transition.

Take into account the next facets of the cutover method. While you run two environments concurrently, you pay for each environments. The pricing for every Amazon MWAA atmosphere is determined by:

  • Period of atmosphere uptime (billed hourly with per-second decision)
  • Surroundings measurement configuration
  • Automated scaling capability for employees
  • Scheduler capability

AWS calculates the price of extra automated scaled employees individually. You possibly can estimate prices to your particular configuration utilizing the AWS Pricing Calculator.

To assist forestall knowledge duplication or corruption throughout parallel operation, we suggest implementing idempotent DAGs. The Airflow scheduler robotically populates some metadata tables (dag, dag_tag, and dag_code) in your new atmosphere. Nevertheless, you want to plan the migration of the next extra metadata elements:

  • DAG historical past
  • Variables
  • Slot pool configurations
  • SLA miss data
  • XCom knowledge
  • Job data
  • Log tables

You possibly can select this method when your necessities prioritize minimal downtime and you may handle the extra operational complexity.

The cutover improve course of entails three foremost steps: creating a brand new atmosphere, restoring it with the present knowledge, and performing the improve. The next diagram illustrates the total workflow.

Cut-over upgrade steps

Within the following sections, we stroll via the important thing steps to carry out a cutover improve.

Conditions

Earlier than you start the improve course of, full the next steps:

Create a brand new atmosphere

Full the next steps to create a brand new atmosphere:

  • Generate a template to your new atmosphere configuration utilizing the AWS CLI:

aws mwaa create-environment --generate-cli-skeleton > .json

  • Modify the generated JSON file:
    • Copy configurations out of your backup file .json to .json.
    • Replace the atmosphere title.
    • Hold the AirflowVersion parameter worth out of your current atmosphere.
    • Overview and replace different configuration parameters as wanted.
  • Create your new atmosphere:

aws mwaa create-environment --cli-input-json

Restore the brand new atmosphere

Full the next steps to revive the brand new atmosphere:

  • Use the mwaa-dr PyPI bundle to create and run the restore DAG.
  • This course of copies metadata out of your S3 backup bucket to the brand new atmosphere.
  • Confirm that your new atmosphere accommodates the anticipated metadata out of your unique atmosphere.

Carry out the model improve

Full the next steps to carry out the model improve:

  • Improve your atmosphere:

aws mwaa update-environment --name --airflow-version

  • Monitor the improve:
    • Observe the atmosphere standing on the console.
    • Look ahead to error messages or warnings.
    • Confirm the atmosphere reaches the AVAILABLE

Plan your transition timing rigorously. When your unique atmosphere continues to course of workflows throughout this improve, the metadata between environments can change.

Clear up

After you confirm the steadiness of your upgraded atmosphere via monitoring, you possibly can start the cleanup course of:

  • Take away your unique Amazon MWAA atmosphere utilizing the AWS CLI command:

 aws mwaa delete-environment --name

  • Clear up your related sources by eradicating unused backup knowledge from S3 buckets, deleting non permanent AWS Identification and Entry Administration (IAM) roles and insurance policies created for the improve, and updating your DNS or routing configurations.

Earlier than eradicating any sources, ensure you comply with your group’s backup retention insurance policies, preserve needed backup knowledge to your compliance necessities, and doc configuration adjustments made in the course of the improve.

This method helps you carry out a managed improve with alternatives for testing and the flexibility to return to your unique atmosphere if wanted.

Monitoring and validation

You possibly can observe your improve progress utilizing Amazon CloudWatch metrics, with a give attention to DAG processing metrics and scheduler heartbeat. Your atmosphere transitions via a number of states in the course of the improve course of, together with UPDATING and CREATING. When your atmosphere reveals the AVAILABLE state, you possibly can start validation testing. We suggest checking system accessibility, testing essential workflow operations, and verifying exterior connections. For detailed monitoring steering, see Monitoring and metrics for Amazon Managed Workflows for Apache Airflow.

Key issues

Think about using infrastructure as code (IaC) practices to assist preserve constant atmosphere administration and help repeatable deployments. Schedule metadata backups utilizing mwaa-dr during times of low exercise to assist defend your knowledge. When designing your workflows, implement idempotent pipelines to assist handle potential interruptions, and preserve documentation of your configurations and dependencies.

Conclusion

A profitable Amazon MWAA improve begins with choosing an method that aligns together with your operational necessities. Whether or not you select an in-place or cutover improve, thorough preparation and testing assist help a managed transition. Utilizing out there instruments, monitoring capabilities, and really useful practices may also help you improve to the newest Amazon MWAA options whereas working to take care of your workflow operations.

For extra particulars and code examples on Amazon MWAA, confer with the Amazon MWAA Person Information and Amazon MWAA examples GitHub repo.

Apache, Apache Airflow, and Airflow are both registered logos or logos of the Apache Software program Basis in the US and/or different nations.


In regards to the Authors

Anurag Srivastava works as a Senior Large Information Cloud Engineer at Amazon Net Providers (AWS), specializing in Amazon MWAA. He’s enthusiastic about serving to clients construct scalable knowledge pipelines and workflow automation options on AWS.

Sriharsh Adari is a Senior Options Architect at Amazon Net Providers (AWS), the place he helps clients work backwards from enterprise outcomes to develop modern options on AWS. Through the years, he has helped a number of clients on knowledge platform transformations throughout trade verticals. His core space of experience embody Know-how Technique, Information Analytics, and Information Science. In his spare time, he enjoys taking part in sports activities, binge-watching TV reveals, and taking part in Tabla.

Venu Thangalapally is a Senior Options Architect at AWS, primarily based in Chicago, with deep experience in cloud structure, knowledge and analytics, containers, and utility modernization. He companions with Monetary Providers trade clients to translate enterprise objectives into safe, scalable, and compliant cloud options that ship measurable worth. Venu is enthusiastic about leveraging know-how to drive innovation and operational excellence. Exterior of labor, he enjoys spending time together with his household, studying, and taking lengthy walks.

Chandan Rupakheti is a Senior Options Architect at AWS. His foremost focus at AWS lies within the intersection of analytics, serverless, and AdTech providers. He’s a passionate technical chief, researcher, and mentor with a knack for constructing modern options within the cloud. Exterior of his skilled life, he loves spending time together with his household and buddies, and listening to and taking part in music.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles