[HTML payload içeriği buraya]
25.1 C
Jakarta
Saturday, June 7, 2025

Finest practices for upgrading Amazon MWAA environments


Amazon Managed Workflows for Apache Airflow (Amazon MWAA) has turn into a cornerstone for organizations embracing data-driven decision-making. As a scalable resolution for managing advanced knowledge pipelines, Amazon MWAA permits seamless orchestration throughout AWS providers and on-premises methods. Though AWS manages the underlying infrastructure, you will need to rigorously plan and execute your Amazon MWAA surroundings updates in keeping with the shared accountability mannequin. Upgrading to the most recent Amazon MWAA model can present important benefits, together with enhanced safety by way of vital safety patches and potential enhancements in efficiency with quicker DAG parsing and decreased database load. You need to use superior options whereas sustaining ecosystem compatibility and receiving prioritized AWS assist. The important thing to profitable upgrades lies in selecting the best resolution and following a methodical implementation method.

On this put up, we discover greatest practices for upgrading your Amazon MWAA surroundings and supply a step-by-step information to seamlessly transition to the most recent model.

Resolution overview

Amazon MWAA gives two major improve options:

  • In-place improve – This methodology works greatest when you’ll be able to accommodate deliberate downtime. You deploy the brand new model immediately in your current infrastructure. In-place model upgrades on Amazon MWAA are supported for environments operating Apache Airflow model 2.x and later. Nevertheless, in case you’re operating model 1.10.z or older variations, you will need to create a brand new surroundings and migrate your assets, as a result of these variations don’t assist in-place upgrades.
  • Cutover improve – This methodology helps decrease disruption to manufacturing environments. You create a brand new Amazon MWAA surroundings with the goal model after which transition out of your previous surroundings to the brand new one.

Every resolution presents a special method that will help you improve whereas working to keep up knowledge integrity and system reliability.

In-place improve

In-place upgrades work nicely for environments the place you’ll be able to 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’ll be able to accommodate deliberate downtime. It helps keep historic knowledge, gives a simple improve course of, and contains rollback capabilities if points happen throughout provisioning. You additionally use fewer assets since you don’t must create a brand new surroundings.

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

In the course of the improve course of, your surroundings can’t schedule or run new duties. Amazon MWAA helps handle the improve course of and implements security measures—if points happen throughout the provisioning section, 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 need to 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 <worth> --airflow-version <worth>

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

In-place upgrade workflow and states

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

Cutover improve

A cutover improve gives an alternate resolution when it’s essential to decrease downtime, although it requires extra guide steps and operational planning. With this method, you create a brand new Amazon MWAA surroundings, migrate your metadata, and handle the transition between environments. Though this methodology presents 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 nicely for environments with advanced workflows, notably once you plan to make important adjustments alongside the model improve. The method presents a number of advantages: you’ll be able to decrease manufacturing downtime, carry out complete testing earlier than switching environments, and keep the power to return to your unique surroundings if wanted. You too can overview and replace your configurations throughout the transition.

Think about the next facets of the cutover method. If you run two environments concurrently, you pay for each environments. The pricing for every Amazon MWAA surroundings is dependent upon:

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

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

To assist stop 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 surroundings. Nevertheless, it’s essential to plan the migration of the next extra metadata parts:

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

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

The cutover improve course of entails three primary steps: creating a brand new surroundings, restoring it with the prevailing knowledge, and performing the improve. The next diagram illustrates the complete workflow.

Cut-over upgrade steps

Within the following sections, we stroll by way of 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 surroundings

Full the next steps to create a brand new surroundings:

  • Generate a template on your new surroundings configuration utilizing the AWS CLI:

aws mwaa create-environment --generate-cli-skeleton > <new-env-name>.json

  • Modify the generated JSON file:
    • Copy configurations out of your backup file <env-name>.json to <new-env-name>.json.
    • Replace the surroundings identify.
    • Maintain the AirflowVersion parameter worth out of your current surroundings.
    • Assessment and replace different configuration parameters as wanted.
  • Create your new surroundings:

aws mwaa create-environment --cli-input-json <content material of new-env-name.json>

Restore the brand new surroundings

Full the next steps to revive the brand new surroundings:

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

Carry out the model improve

Full the next steps to carry out the model improve:

  • Improve your surroundings:

aws mwaa update-environment --name <new-env-name> --airflow-version <target-version>

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

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

Clear up

After you confirm the steadiness of your upgraded surroundings by way of monitoring, you’ll be able to start the cleanup course of:

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

 aws mwaa delete-environment --name <old-env-name>

  • Clear up your related assets by eradicating unused backup knowledge from S3 buckets, deleting short-term AWS Id and Entry Administration (IAM) roles and insurance policies created for the improve, and updating your DNS or routing configurations.

Earlier than eradicating any assets, be sure you observe your group’s backup retention insurance policies, keep vital backup knowledge on your compliance necessities, and doc configuration adjustments made throughout the improve.

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

Monitoring and validation

You possibly can observe your improve progress utilizing Amazon CloudWatch metrics, with a deal with DAG processing metrics and scheduler heartbeat. Your surroundings transitions by way of a number of states throughout the improve course of, together with UPDATING and CREATING. When your surroundings exhibits the AVAILABLE state, you’ll be able to start validation testing. We suggest checking system accessibility, testing vital 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 keep constant surroundings administration and assist repeatable deployments. Schedule metadata backups utilizing mwaa-dr during times of low exercise to assist shield your knowledge. When designing your workflows, implement idempotent pipelines to assist handle potential interruptions, and keep documentation of your configurations and dependencies.

Conclusion

A profitable Amazon MWAA improve begins with deciding on an method that aligns along with your operational necessities. Whether or not you select an in-place or cutover improve, thorough preparation and testing assist assist a managed transition. Utilizing out there instruments, monitoring capabilities, and really helpful practices can assist you improve to the most recent Amazon MWAA options whereas working to keep up your workflow operations.

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

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


In regards to the Authors

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

Sriharsh Adari is a Senior Options Architect at Amazon Net Companies (AWS), the place he helps prospects work backwards from enterprise outcomes to develop modern options on AWS. Over time, he has helped a number of prospects on knowledge platform transformations throughout trade verticals. His core space of experience embrace Expertise Technique, Information Analytics, and Information Science. In his spare time, he enjoys enjoying sports activities, binge-watching TV exhibits, and enjoying Tabla.

Venu Thangalapally is a Senior Options Architect at AWS, based mostly in Chicago, with deep experience in cloud structure, knowledge and analytics, containers, and utility modernization. He companions with Monetary Companies trade prospects to translate enterprise objectives into safe, scalable, and compliant cloud options that ship measurable worth. Venu is keen about leveraging expertise 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 primary 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 enjoying music.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles