Bird
Raised Fist0
Apache Airflowdevops~20 mins

Managed Airflow (MWAA, Cloud Composer, Astronomer) - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Managed Airflow Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Managed Airflow Services

Which of the following statements correctly describes a key advantage of using Managed Airflow services like MWAA, Cloud Composer, or Astronomer?

AThey require manual installation and management of Airflow components on your own servers.
BThey prevent you from customizing DAGs or plugins in any way.
CThey only support running Airflow on local machines, not in the cloud.
DThey automatically handle Airflow infrastructure, scaling, and upgrades for you.
Attempts:
2 left
💡 Hint

Think about what 'managed' means in cloud services.

💻 Command Output
intermediate
2:00remaining
Checking MWAA Environment Status

You run the AWS CLI command to list MWAA environments:

aws mwaa list-environments --region us-east-1

What is the expected output format of this command?

A{"Environments": ["prod-airflow", "dev-airflow"]}
B["prod-airflow", "dev-airflow"]
C{"EnvironmentNames": ["prod-airflow", "dev-airflow"]}
D{"Envs": ["prod-airflow", "dev-airflow"]}
Attempts:
2 left
💡 Hint

Check AWS CLI documentation for MWAA list-environments output keys.

❓ Configuration
advanced
2:30remaining
Configuring Airflow Connections in Cloud Composer

Which of the following is the correct way to add a new connection to Airflow in Google Cloud Composer using the gcloud CLI?

Agcloud composer environments run ENVIRONMENT_NAME --location LOCATION connections add --conn_id my_conn --conn_type mysql --conn_host 127.0.0.1 --conn_port 3306
Bgcloud composer environments run ENVIRONMENT_NAME --location LOCATION connections -- add --conn_id my_conn --conn_type mysql --conn_host 127.0.0.1 --conn_port 3306
Cgcloud composer environments run ENVIRONMENT_NAME --location LOCATION connections --add --conn_id my_conn --conn_type mysql --conn_host 127.0.0.1 --conn_port 3306
Dgcloud composer environments run ENVIRONMENT_NAME --location LOCATION connections -- add --conn_id=my_conn --conn_type=mysql --conn_host=127.0.0.1 --conn_port=3306
Attempts:
2 left
💡 Hint

Remember the syntax for running Airflow CLI commands through gcloud composer environments run.

❓ Troubleshoot
advanced
2:30remaining
Diagnosing DAG Deployment Issues in Astronomer

You deployed a new DAG to Astronomer, but it does not appear in the Airflow UI. Which of the following is the most likely cause?

AAstronomer does not support custom DAGs.
BThe DAG was deployed but Airflow UI caches the old list and needs a browser refresh.
CThe DAG file has a syntax error causing it to fail parsing.
DThe DAG file was placed in the plugins folder instead of the DAGs folder.
Attempts:
2 left
💡 Hint

Think about what happens if Airflow cannot parse a DAG file.

🔀 Workflow
expert
3:00remaining
Automating MWAA Environment Updates

You want to automate updating the Airflow configuration options in an MWAA environment using AWS CLI. Which sequence of commands correctly updates the environment's Airflow configuration options and then triggers the environment update?

Aaws mwaa update-environment --name my-env --airflow-configuration-options '{"core.dag_concurrency":"10"}'
Baws mwaa update-environment --name my-env --airflow-configuration-options core.dag_concurrency=10 && aws mwaa get-environment --name my-env
Caws mwaa update-environment --name my-env --airflow-configuration-options '{"core.dag_concurrency":10}'
Daws mwaa update-environment --name my-env --airflow-configuration-options {"core.dag_concurrency":"10"} && aws mwaa get-environment --name my-env
Attempts:
2 left
💡 Hint

Check the correct JSON format and quoting for the --airflow-configuration-options parameter.

Practice

(1/5)
1. What is the main advantage of using a managed Airflow service like AWS MWAA or Google Cloud Composer?
easy
A. You don't need to manage the Airflow servers yourself.
B. You write DAGs in a new proprietary language.
C. You must manually install Airflow updates.
D. You cannot customize your workflows.

Solution

  1. Step 1: Understand managed Airflow services

    Managed Airflow services handle the infrastructure and server management for you.
  2. Step 2: Compare options

    The other options are incorrect because managed services still use Python DAGs, handle updates automatically, and allow workflow customization.
  3. Final Answer:

    You don't need to manage the Airflow servers yourself. -> Option A
  4. Quick Check:

    Managed Airflow = No server management [OK]
Hint: Managed means no server setup needed [OK]
Common Mistakes:
  • Thinking you must manage Airflow servers manually
  • Believing DAGs use a new language
  • Assuming no workflow customization is possible
2. Which of the following is the correct way to upload your DAGs to AWS MWAA?
easy
A. Upload DAG files to an S3 bucket linked to MWAA.
B. SSH into the MWAA server and copy DAG files.
C. Use FTP to transfer DAG files to MWAA.
D. Email DAG files to AWS support.

Solution

  1. Step 1: Identify MWAA DAG upload method

    AWS MWAA uses an S3 bucket to store DAG files that it reads automatically.
  2. Step 2: Eliminate incorrect methods

    SSH and FTP are not supported because MWAA is fully managed and does not expose servers. Emailing files is not a valid method.
  3. Final Answer:

    Upload DAG files to an S3 bucket linked to MWAA. -> Option A
  4. Quick Check:

    MWAA DAGs stored in S3 bucket [OK]
Hint: MWAA DAGs live in S3 buckets [OK]
Common Mistakes:
  • Trying to SSH into MWAA servers
  • Using FTP which is unsupported
  • Thinking AWS support manages DAG uploads
3. Given this snippet of a DAG uploaded to Google Cloud Composer, what will happen when the DAG runs?
from airflow import DAG
from airflow.operators.bash import BashOperator
from datetime import datetime
with DAG('example_dag', start_date=datetime(2024, 1, 1), schedule_interval='@daily') as dag:
    task1 = BashOperator(task_id='print_date', bash_command='date')
    task2 = BashOperator(task_id='sleep', bash_command='sleep 5')
    task1 >> task2
medium
A. The DAG runs once and fails due to syntax error.
B. The DAG runs daily but skips the sleep task.
C. The DAG runs daily but tasks run in parallel.
D. The DAG runs daily, printing the date then sleeping for 5 seconds.

Solution

  1. Step 1: Analyze DAG schedule and tasks

    The DAG is scheduled daily starting Jan 1, 2024. It has two tasks: print_date and sleep.
  2. Step 2: Understand task dependencies

    task1 >> task2 means task1 runs before task2. So print_date runs first, then sleep runs for 5 seconds.
  3. Final Answer:

    The DAG runs daily, printing the date then sleeping for 5 seconds. -> Option D
  4. Quick Check:

    schedule=@daily; task1 >> task2 [OK]
Hint: >> means run first task before second [OK]
Common Mistakes:
  • Assuming tasks run in parallel
  • Thinking the DAG has syntax errors
  • Believing the sleep task is skipped
4. You deployed a DAG to Astronomer but it does not appear in the Airflow UI. What is the most likely cause?
medium
A. Astronomer does not support Python DAGs.
B. The DAG file has a syntax error preventing it from loading.
C. You need to restart the Astronomer platform manually.
D. The DAG file is too large to upload.

Solution

  1. Step 1: Check DAG loading requirements

    Astronomer runs standard Airflow and requires valid Python DAG files to load and show in UI.
  2. Step 2: Identify common loading issues

    If the DAG has syntax errors, Airflow will skip loading it, so it won't appear in the UI.
  3. Final Answer:

    The DAG file has a syntax error preventing it from loading. -> Option B
  4. Quick Check:

    Syntax errors block DAG loading [OK]
Hint: Syntax errors hide DAGs in UI [OK]
Common Mistakes:
  • Thinking Astronomer doesn't support Python DAGs
  • Assuming manual restart is needed
  • Believing file size blocks upload
5. You want to ensure your DAG in AWS MWAA uses a custom Python package not included by default. What is the best way to add this package?
hard
A. Include the package code inside your DAG Python file.
B. Manually install the package on the MWAA server via SSH.
C. Create a requirements.txt file with the package and upload it to the MWAA environment.
D. Request AWS support to install the package for you.

Solution

  1. Step 1: Understand MWAA custom package installation

    MWAA allows adding Python packages by uploading a requirements.txt file listing them.
  2. Step 2: Eliminate incorrect options

    SSH access is not allowed, embedding package code in DAG is bad practice, and AWS support does not install packages on demand.
  3. Final Answer:

    Create a requirements.txt file with the package and upload it to the MWAA environment. -> Option C
  4. Quick Check:

    requirements.txt is standard for MWAA packages [OK]
Hint: Use requirements.txt to add packages in MWAA [OK]
Common Mistakes:
  • Trying to SSH into MWAA servers
  • Embedding package code inside DAG files
  • Expecting AWS support to install packages
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard