{"id":4875,"library":"apache-airflow-providers-alibaba","title":"Apache Airflow Alibaba Cloud Provider","description":"The Apache Airflow Alibaba Cloud Provider enables integration with various Alibaba Cloud services such as Object Storage Service (OSS), DataWorks, DirectMail, and more. It provides hooks, operators, and sensors to incorporate Alibaba Cloud workflows into Airflow DAGs. This provider is currently at version 3.3.7 and receives updates typically aligned with Apache Airflow's release cycle or as individual feature/bugfix releases.","status":"active","version":"3.3.7","language":"en","source_language":"en","source_url":"https://github.com/apache/airflow/tree/main/airflow/providers/alibaba","tags":["airflow","provider","alibaba","cloud"],"install":[{"cmd":"pip install apache-airflow-providers-alibaba","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core Airflow library is required for any provider.","package":"apache-airflow","optional":false},{"reason":"Base SDK for Alibaba Cloud APIs.","package":"aliyun-python-sdk-core","optional":false},{"reason":"SDK for Alibaba Cloud DirectMail service, used by DirectMail operators/hooks.","package":"aliyun-python-sdk-dm","optional":true},{"reason":"SDK for Alibaba Cloud Object Storage Service (OSS), used by OSS operators/hooks.","package":"oss2","optional":true}],"imports":[{"symbol":"DirectMailSendMailOperator","correct":"from airflow.providers.alibaba.cloud.operators.directmail import DirectMailSendMailOperator"},{"symbol":"OSSCopyObjectOperator","correct":"from airflow.providers.alibaba.cloud.operators.oss import OSSCopyObjectOperator"},{"note":"The base hook was moved to `hooks.base` in versions >=3.0.0; direct use is discouraged for internal reasons.","wrong":"from airflow.providers.alibaba.cloud.connection import AlibabaCloudBaseHook","symbol":"AlibabaCloudBaseHook","correct":"from airflow.providers.alibaba.cloud.hooks.base import AlibabaCloudBaseHook"}],"quickstart":{"code":"from __future__ import annotations\n\nimport pendulum\n\nfrom airflow.models.dag import DAG\nfrom airflow.providers.alibaba.cloud.operators.directmail import DirectMailSendMailOperator\n\n# Before running this DAG:\n# 1. Create an Airflow Connection:\n#    - Conn Id: 'alibaba_cloud_default'\n#    - Conn Type: 'Alibaba Cloud'\n#    - Host: 'https://dm.cn-hangzhou.aliyuncs.com' (or your DirectMail endpoint)\n#    - Login: YOUR_ALIYUN_ACCESS_KEY_ID\n#    - Password: YOUR_ALIYUN_ACCESS_KEY_SECRET\n#    - Extra: {'region': 'cn-hangzhou'} (or your service region)\n# 2. Ensure 'account_name' is a verified sender email in your Alibaba DirectMail console.\n# 3. Replace 'recipient@example.com' with an actual recipient.\n\nwith DAG(\n    dag_id=\"alibaba_directmail_send_example\",\n    schedule=None,\n    start_date=pendulum.datetime(2023, 10, 26, tz=\"UTC\"),\n    catchup=False,\n    tags=[\"alibaba\", \"directmail\", \"example\"],\n) as dag:\n    send_mail_task = DirectMailSendMailOperator(\n        task_id=\"send_test_email\",\n        conn_id=\"alibaba_cloud_default\",\n        account_name=\"no-reply@your-domain.com\",  # Your verified sender address\n        from_alias=\"Airflow Notification\",\n        to_address=\"recipient@example.com\",      # Recipient email\n        subject=\"Airflow Test Email from Alibaba DirectMail\",\n        html_body=\"This is a test email sent from Apache Airflow using Alibaba Cloud DirectMail.\",\n        region=\"cn-hangzhou\",                    # Must match your DirectMail service region\n    )","lang":"python","description":"This quickstart demonstrates sending an email using the `DirectMailSendMailOperator`. It requires an 'Alibaba Cloud' connection named `alibaba_cloud_default` to be configured in Airflow with appropriate credentials and region. Replace placeholder emails and ensure the sender is a verified DirectMail account."},"warnings":[{"fix":"Review custom integrations inheriting from `AlibabaCloudBaseHook` and adapt to the new import path and connection architecture. Direct instantiation of `AlibabaCloudBaseHook` is generally not recommended.","message":"Version 3.0.0 introduced significant internal changes, including the relocation of `AlibabaCloudBaseHook` from `airflow.providers.alibaba.cloud.connection` to `airflow.providers.alibaba.cloud.hooks.base`. This impacts custom hooks or operators inheriting directly from the base hook.","severity":"breaking","affected_versions":"<3.0.0 upgrading to >=3.0.0"},{"fix":"Ensure the Airflow connection (e.g., `alibaba_cloud_default`) is correctly configured, including the `Conn Type`, credentials, and the exact region (`cn-hangzhou`, `us-east-1`, etc.) where your Alibaba Cloud resources are provisioned.","message":"Alibaba Cloud connections require specific configuration fields in Airflow. The `Conn Type` must be 'Alibaba Cloud', and `Login` (Access Key ID), `Password` (Access Key Secret), and `Extra` (`{\"region\": \"your-region\"}`) fields are critical. Incorrect region configuration is a common cause of 'service not available' or authentication errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Verify that the RAM policy attached to the user or role used for authentication grants the required actions on the target Alibaba Cloud services and resources.","message":"The Alibaba Cloud RAM user associated with the Access Key ID and Secret must possess the necessary IAM permissions for the specific Alibaba Cloud service being accessed (e.g., `DirectMail:SendMail`, `OSS:PutObject`). Missing permissions will result in 'Access Denied' errors from the service.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Explicitly specify the correct region in the Airflow connection's 'Extra' field or directly in the operator's arguments to match the location of your Alibaba Cloud resources.","message":"Many Alibaba Cloud services are regional. Ensure that the `region` parameter supplied to operators or defined in the Airflow connection matches the region where your specific Alibaba Cloud resource (e.g., OSS bucket, DirectMail sender domain, DataWorks workspace) exists. Cross-region access for some services may be restricted or require specific configurations.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}