asongent opened a new issue, #38061:
URL: https://github.com/apache/airflow/issues/38061

   ### Body
   
   I am learning how to create an EC2 instance with *airflow* but i continue to 
have syntax error listed below.
   
   ```
   Broken DAG: [/opt/airflow/dags/repo/dags/ec2_create.py] Traceback (most 
recent call last):
     File "/opt/airflow/dags/repo/dags/ec2_create.py", line 31, in <module>
       create_instance_task = EC2CreateInstanceOperator(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/home/airflow/.local/lib/python3.11/site-packages/airflow/models/baseoperator.py",
 line 420, in apply_defaults
       raise AirflowException(f"missing keyword argument 
{missing_args.pop()!r}")
   airflow.exceptions.AirflowException: missing keyword argument 'image_id'
   ```
   ---
   *Airflow version 2.7.3*
   
   Here is my DAG
   
   ```
   from datetime import datetime
   from airflow import DAG
   from airflow.providers.amazon.aws.operators.ec2 import 
EC2CreateInstanceOperator
   from airflow.utils.trigger_rule import TriggerRule
   
   default_args = {
       'owner': 'airflow',
       'depends_on_past': False,
       'email_on_failure': False,
       'email_on_retry': False,
       'retries': 1
   }
   
   dag = DAG(
       'create_ec2_instance',
       default_args=default_args,
       description='A DAG to create an EC2 instance',
       schedule_interval=None,
       start_date=datetime(2024, 3, 11)
   )
   
   ec2_kwargs = {
       'ImageId': 'ami-0c55b6fgfufafe1f0', 
       'InstanceType': 't3.medium',
       'KeyName': 'server-key',
       'SubnetId': 'subnet-5d898650',
       'SecurityGroupIds': ['sg-03463c6b9f2'],
       'TagSpecifications': [{'ResourceType': 'instance', 'Tags': [{'Key': 
'Name', 'Value': 'Airflow-Server'}]}],
   }
   
   create_instance_task = EC2CreateInstanceOperator(
       task_id='create_instance',
       aws_conn_id='aws_default',
       ec2_kwargs=ec2_kwargs,
       wait_for_completion=True,
       trigger_rule=TriggerRule.ALL_SUCCESS,
       dag=dag,
   )
   ```
   Please take a look and let me know what I am doing wrong.
   Thank you in advance.
   
   ### Committer
   
   - [X] I acknowledge that I am a maintainer/committer of the Apache Airflow 
project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to