A connection in Airflow stores the information needed to connect to external systems like cloud services, databases, or APIs. It includes details like host, login, password, and extra parameters.
Click to reveal answer
beginner
How do you add a new cloud service connection in Airflow UI?
Go to Admin > Connections, click the '+' button, fill in the connection details such as Conn Id, Conn Type (e.g., Google Cloud, AWS), host, login, password, and extra JSON parameters, then save.
Click to reveal answer
intermediate
What is the purpose of the 'Extra' field in Airflow connections?
The 'Extra' field stores additional JSON-formatted parameters needed for the connection, like project IDs, scopes, or authentication keys for cloud services.
Click to reveal answer
intermediate
How can you use a connection in an Airflow DAG?
You reference the connection by its Conn Id in operators or hooks. Airflow uses the stored credentials to authenticate and interact with the cloud service during task execution.
Click to reveal answer
beginner
Why is managing connections centrally in Airflow beneficial?
It keeps sensitive credentials secure and separate from code, allows easy updates without changing DAGs, and promotes reuse of connection info across multiple tasks and DAGs.
Click to reveal answer
Where do you manage cloud service connections in Airflow?
ADAG Editor
BAdmin > Connections
CTask Logs
DPlugins
✗ Incorrect
Connections are managed centrally under Admin > Connections in the Airflow UI.
What format is used in the 'Extra' field for connection parameters?
AJSON
BYAML
CPlain text
DXML
✗ Incorrect
The 'Extra' field uses JSON format to store additional connection parameters.
Which Airflow component uses the connection information during task execution?
AHook or Operator
BExecutor
CScheduler
DWebserver
✗ Incorrect
Hooks and Operators use connection info to authenticate and interact with external services.
Why should credentials be stored in Airflow connections instead of hardcoded in DAGs?
ATo speed up task execution
BTo improve code readability
CTo reduce DAG size
DTo keep credentials secure and separate from code
✗ Incorrect
Storing credentials in connections keeps them secure and separate from code, making management easier.
Which of these is NOT a typical connection type in Airflow for cloud services?
AGoogle Cloud
BAWS
CFTP Server
DAzure
✗ Incorrect
FTP Server is not a cloud service connection type; it is a file transfer protocol connection.
Explain how Airflow manages connections to cloud services and why this is important.
Think about how Airflow separates connection info from code.
You got /4 concepts.
Describe the steps to add a new AWS connection in Airflow UI.
Focus on the UI path and required fields.
You got /5 concepts.
Practice
(1/5)
1. What is the main purpose of managing connections in Airflow for cloud services?
easy
A. To manually enter credentials every time a task runs
B. To write custom code for each cloud service login
C. To store cloud login details securely and reuse them in tasks
D. To disable cloud service access in Airflow
Solution
Step 1: Understand connection management role
Connection management stores credentials securely so tasks can access cloud services without exposing secrets.
Step 2: Identify reuse benefit
Reusing connections avoids repeating credentials in multiple tasks, making workflows cleaner and safer.
Final Answer:
To store cloud login details securely and reuse them in tasks -> Option C
Quick Check:
Secure storage + reuse = A [OK]
Hint: Connections store credentials once for many tasks [OK]
Common Mistakes:
Thinking credentials must be typed in each task
Assuming connections are only for UI use
Believing connections disable cloud access
2. Which command correctly adds a Google Cloud connection named 'gcp_default' in Airflow CLI?
easy
A. airflow connections add 'gcp_default' --conn-type google_cloud_platform --conn-extra '{"extra__google_cloud_platform__key_path":"/path/key.json"}'
B. airflow add connection gcp_default --type gcp --extra '{"key_path":"/path/key.json"}'
C. airflow connections create gcp_default --type google --extra '{"key":"/path/key.json"}'
D. airflow connection add gcp_default --conn-type gcp --conn-extra '{"key_path":"/path/key.json"}'
Solution
Step 1: Recall correct Airflow CLI syntax
The command to add connections is 'airflow connections add' followed by connection id and parameters.
Step 2: Match correct flags and JSON format
airflow connections add 'gcp_default' --conn-type google_cloud_platform --conn-extra '{"extra__google_cloud_platform__key_path":"/path/key.json"}' uses '--conn-type google_cloud_platform' and properly formatted JSON for extra parameters, matching Airflow docs.