Amazon Managed Workflows for Apache Airflow (Amazon MWAA) has change into a cornerstone for organizations embracing data-driven decision-making. As a scalable resolution for managing advanced information pipelines, Amazon MWAA allows seamless orchestration throughout AWS providers and on-premises techniques. Though AWS manages the underlying infrastructure, you have to fastidiously plan and execute your Amazon MWAA setting updates in response to the shared accountability mannequin. Upgrading to the newest Amazon MWAA model can present vital benefits, together with enhanced safety by means of vital safety patches and potential enhancements in efficiency with quicker DAG parsing and lowered database load. You need to use superior options whereas sustaining ecosystem compatibility and receiving prioritized AWS help. The important thing to profitable upgrades lies in choosing the proper resolution and following a methodical implementation strategy.
On this submit, we discover finest practices for upgrading your Amazon MWAA setting and supply a step-by-step information to seamlessly transition to the newest model.
Resolution overview
Amazon MWAA offers two main improve options:
- In-place improve – This technique works finest 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 working Apache Airflow model 2.x and later. Nevertheless, in case you’re working model 1.10.z or older variations, you have to create a brand new setting and migrate your sources, as a result of these variations don’t help in-place upgrades.
- Cutover improve – This technique helps decrease disruption to manufacturing environments. You create a brand new Amazon MWAA setting with the goal model after which transition out of your previous setting to the brand new one.
Every resolution affords a unique strategy that will help you improve whereas working to keep up information integrity and system reliability.
In-place improve
In-place upgrades work effectively 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 technique works finest when you’ll be able to accommodate deliberate downtime. It helps keep historic information, offers 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 setting.
You may carry out in-place upgrades by means of the AWS Administration Console with a single operation. This course of helps scale back operational overhead by managing many improve steps for you.
Throughout the improve course of, your setting 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 part, the service makes an attempt to revert to the earlier steady 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:
The next diagram reveals the Amazon MWAA in-place improve workflow and states.
Consult with Introducing in-place model upgrades with Amazon MWAA for extra particulars.
Cutover improve
A cutover improve offers an alternate resolution when you should decrease downtime, although it requires extra guide steps and operational planning. With this strategy, you create a brand new Amazon MWAA setting, migrate your metadata, and handle the transition between environments. Though this technique affords extra management over the improve course of, it requires further planning and execution effort in comparison with an in-place improve.
This technique can work effectively for environments with advanced workflows, significantly if you plan to make vital modifications alongside the model improve. The strategy affords a number of advantages: you’ll be able to decrease manufacturing downtime, carry out complete testing earlier than switching environments, and keep the flexibility to return to your authentic setting if wanted. You may also overview and replace your configurations throughout the transition.
Take into account the next facets of the cutover strategy. While you run two environments concurrently, you pay for each environments. The pricing for every Amazon MWAA setting will depend on:
- Period of setting uptime (billed hourly with per-second decision)
- Setting dimension configuration
- Computerized scaling capability for employees
- Scheduler capability
AWS calculates the price of further automated scaled employees individually. You may estimate prices on your particular configuration utilizing the AWS Pricing Calculator.
To assist forestall information 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 setting. Nevertheless, you should plan the migration of the next further metadata parts:
- DAG historical past
- Variables
- Slot pool configurations
- SLA miss information
- XCom information
- Job information
- Log tables
You may select this strategy when your necessities prioritize minimal downtime and you’ll handle the extra operational complexity.
The cutover improve course of includes three predominant steps: creating a brand new setting, restoring it with the prevailing information, and performing the improve. The next diagram illustrates the complete workflow.
Within the following sections, we stroll by means of the important thing steps to carry out a cutover improve.
Stipulations
Earlier than you start the improve course of, full the next steps:
Create a brand new setting
Full the next steps to create a brand new setting:
- Generate a template on your new setting configuration utilizing the AWS CLI:
- Modify the generated JSON file:
- Copy configurations out of your backup file
.json to .json. - Replace the setting identify.
- Hold the AirflowVersion parameter worth out of your current setting.
- Evaluation and replace different configuration parameters as wanted.
- Copy configurations out of your backup file
- Create your new setting:
Restore the brand new setting
Full the next steps to revive the brand new setting:
- 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 setting.
- Confirm that your new setting comprises the anticipated metadata out of your authentic setting.
Carry out the model improve
Full the next steps to carry out the model improve:
- Improve your setting:
- Monitor the improve:
- Monitor the setting standing on the console.
- Look ahead to error messages or warnings.
- Confirm the setting reaches the AVAILABLE
Plan your transition timing fastidiously. When your authentic setting continues to course of workflows throughout this improve, the metadata between environments can change.
Clear up
After you confirm the soundness of your upgraded setting by means of monitoring, you’ll be able to start the cleanup course of:
- Take away your authentic Amazon MWAA setting utilizing the AWS CLI command:
- Clear up your related sources by eradicating unused backup information 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, be sure to observe your group’s backup retention insurance policies, keep essential backup information on your compliance necessities, and doc configuration modifications made throughout the improve.
This strategy helps you carry out a managed improve with alternatives for testing and the flexibility to return to your authentic setting if wanted.
Monitoring and validation
You may monitor your improve progress utilizing Amazon CloudWatch metrics, with a concentrate on DAG processing metrics and scheduler heartbeat. Your setting transitions by means of a number of states throughout the improve course of, together with UPDATING and CREATING. When your setting reveals 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 concerns
Think about using infrastructure as code (IaC) practices to assist keep constant setting administration and help repeatable deployments. Schedule metadata backups utilizing mwaa-dr in periods of low exercise to assist shield your information. 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 strategy 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 obtainable instruments, monitoring capabilities, and really helpful practices may help you improve to the newest Amazon MWAA options whereas working to keep up your workflow operations.
For added 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 emblems or emblems of the Apache Software program Basis in the US and/or different international locations.
In regards to the Authors
Anurag Srivastava works as a Senior Massive Knowledge Cloud Engineer at Amazon Net Providers (AWS), specializing in Amazon MWAA. He’s enthusiastic about serving to clients construct scalable information 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 revolutionary options on AWS. Through the years, he has helped a number of clients on information platform transformations throughout business verticals. His core space of experience embody Expertise Technique, Knowledge Analytics, and Knowledge Science. In his spare time, he enjoys enjoying sports activities, binge-watching TV reveals, and enjoying Tabla.
Venu Thangalapally is a Senior Options Architect at AWS, based mostly in Chicago, with deep experience in cloud structure, information and analytics, containers, and utility modernization. He companions with Monetary Providers business clients to translate enterprise targets into safe, scalable, and compliant cloud options that ship measurable worth. Venu is enthusiastic about leveraging expertise to drive innovation and operational excellence. Outdoors 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 predominant 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 revolutionary options within the cloud. Outdoors of his skilled life, he loves spending time together with his household and buddies, and listening to and enjoying music.