Skip to content

Amazon MWAA Environments > Airflow 2.10.1 > MWAA Airflow 2.10.1 timezone Argument Not Supported in DAG() Constructor

0

Hello AWS Support,

We are using Amazon MWAA with Airflow version 2.10.1 as shown in the MWAA console. However, when we include the timezone parameter in the DAG() constructor — which is supported in open-source Airflow 2.2.0+ — we receive the following error:

TypeError: DAG.__init__() got an unexpected keyword argument 'timezone' According to the official Airflow changelog and documentation, this parameter should be supported in version 2.10.1. Could you please confirm whether this functionality is intentionally unsupported in the MWAA implementation? And if so, is there a timeline for when full DAG timezone support will be available in MWAA?

We’d appreciate any workaround or guidance to schedule DAGs in local timezones (e.g., US/Eastern) without relying on UTC-based scheduling and manual conversions in task logic.

Thank you, Jeet

asked 10 months ago140 views
2 Answers
0

Amazon MWAA now supports Apache Airflow version 2.10, which was released on September 26, 2024. This is the latest minor release of Apache Airflow available on MWAA.

Regarding your issue with the timezone parameter in the DAG() constructor, while this should be supported in Airflow 2.10, you might need to use an alternative approach for changing a DAG's timezone in Amazon MWAA. The recommended method is to use the Pendulum library to create timezone-aware DAGs.

For example, you can use Pendulum in your DAG definition instead of directly using the timezone parameter:

import pendulum
from airflow import DAG

local_tz = pendulum.timezone("US/Eastern")

with DAG(
'example_dag',
start_date=pendulum.datetime(2021, 1, 1, tz=local_tz),
schedule_interval='0 0 * * *',
) as dag:
# Your tasks here

This approach should work with Apache Airflow v2 in Python 3.10, which is compatible with MWAA. If you continue to experience issues, you might want to check if there are any specific configuration overrides in your MWAA environment that could be affecting the timezone functionality.
Sources
Amazon MWAA now supports Apache Airflow version 2.10 - AWS
Changing a DAG's timezone on Amazon MWAA - Amazon Managed Workflows for Apache Airflow

answered 10 months ago
0

Hello AWS Support, Thank you for confirming that MWAA 2.10.1 supports Apache Airflow 2.10 and for your guidance on using Pendulum to create timezone-aware start_date values. I wanted to follow up with an important clarification: While setting a start_date with pendulum.timezone("US/Eastern") works, the execution_date provided by Airflow remains in UTC, unless we set the timezone= argument in the DAG() constructor — which MWAA currently does not support (as confirmed by the error we encountered). This means that any logic relying on execution_date (e.g., branching, scheduling alerts, file availability windows) must still perform manual timezone conversion like:

dt = kwargs["execution_date"].in_tz(pendulum.timezone("US/Eastern"))

So while the workaround works technically, we just wanted to confirm that this limitation — the lack of native DAG-level timezone handling — is expected behavior on MWAA, even in Airflow 2.10. I'd appreciate confirmation, and if there’s a roadmap for full timezone= support on MWAA, I’d be happy to track that as well.

Thanks, Jeet

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.