airflow.providers.amazon.aws.operators.ec2¶
Classes¶
| Start AWS EC2 instance using boto3. | |
| Stop AWS EC2 instance using boto3. | |
| Create and start a specified number of EC2 Instances using boto3. | |
| Terminate EC2 Instances using boto3. | |
| Reboot Amazon EC2 instances. | |
| Hibernate Amazon EC2 instances. | 
Module Contents¶
- class airflow.providers.amazon.aws.operators.ec2.EC2StartInstanceOperator(*, instance_id, check_interval=15, **kwargs)[source]¶
- Bases: - airflow.providers.amazon.aws.operators.base_aws.AwsBaseOperator[- airflow.providers.amazon.aws.hooks.ec2.EC2Hook]- Start AWS EC2 instance using boto3. - See also - For more information on how to use this operator, take a look at the guide: Start an Amazon EC2 instance - Parameters:
- instance_id (str) – id of the AWS EC2 instance :param aws_conn_id: The Airflow connection used for AWS credentials. If this is - Noneor empty then the default boto3 behaviour is used. If running Airflow in a distributed manner and aws_conn_id is None or empty, then default boto3 configuration would be used (and must be maintained on each worker node).
- region_name – AWS region_name. If not specified then the default boto3 behaviour is used. 
- verify – Whether or not to verify SSL certificates. See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html 
- check_interval (float) – time in seconds that the job should wait in between each instance state checks until operation is completed 
 
 - template_fields: collections.abc.Sequence[str][source]¶
 
- class airflow.providers.amazon.aws.operators.ec2.EC2StopInstanceOperator(*, instance_id, check_interval=15, **kwargs)[source]¶
- Bases: - airflow.providers.amazon.aws.operators.base_aws.AwsBaseOperator[- airflow.providers.amazon.aws.hooks.ec2.EC2Hook]- Stop AWS EC2 instance using boto3. - See also - For more information on how to use this operator, take a look at the guide: Stop an Amazon EC2 instance - Parameters:
- instance_id (str) – id of the AWS EC2 instance 
- aws_conn_id – The Airflow connection used for AWS credentials. If this is - Noneor empty then the default boto3 behaviour is used. If running Airflow in a distributed manner and aws_conn_id is None or empty, then default boto3 configuration would be used (and must be maintained on each worker node).
- region_name – AWS region_name. If not specified then the default boto3 behaviour is used. 
- verify – Whether or not to verify SSL certificates. See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html 
- check_interval (float) – time in seconds that the job should wait in between each instance state checks until operation is completed 
 
 - template_fields: collections.abc.Sequence[str][source]¶
 
- class airflow.providers.amazon.aws.operators.ec2.EC2CreateInstanceOperator(image_id, max_count=1, min_count=1, poll_interval=20, max_attempts=20, config=None, wait_for_completion=False, **kwargs)[source]¶
- Bases: - airflow.providers.amazon.aws.operators.base_aws.AwsBaseOperator[- airflow.providers.amazon.aws.hooks.ec2.EC2Hook]- Create and start a specified number of EC2 Instances using boto3. - See also - For more information on how to use this operator, take a look at the guide: Create and start an Amazon EC2 instance - Parameters:
- image_id (str) – ID of the AMI used to create the instance. 
- max_count (int) – Maximum number of instances to launch. Defaults to 1. 
- min_count (int) – Minimum number of instances to launch. Defaults to 1. 
- aws_conn_id – The Airflow connection used for AWS credentials. If this is - Noneor empty then the default boto3 behaviour is used. If running Airflow in a distributed manner and aws_conn_id is None or empty, then default boto3 configuration would be used (and must be maintained on each worker node).
- region_name – AWS region_name. If not specified then the default boto3 behaviour is used. 
- verify – Whether or not to verify SSL certificates. See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html 
- poll_interval (int) – Number of seconds to wait before attempting to check state of instance. Only used if wait_for_completion is True. Default is 20. 
- max_attempts (int) – Maximum number of attempts when checking state of instance. Only used if wait_for_completion is True. Default is 20. 
- config (dict | None) – Dictionary for arbitrary parameters to the boto3 run_instances call. 
- wait_for_completion (bool) – If True, the operator will wait for the instance to be in the running state before returning. 
 
 - template_fields: collections.abc.Sequence[str][source]¶
 
- class airflow.providers.amazon.aws.operators.ec2.EC2TerminateInstanceOperator(instance_ids, poll_interval=20, max_attempts=20, wait_for_completion=False, **kwargs)[source]¶
- Bases: - airflow.providers.amazon.aws.operators.base_aws.AwsBaseOperator[- airflow.providers.amazon.aws.hooks.ec2.EC2Hook]- Terminate EC2 Instances using boto3. - See also - For more information on how to use this operator, take a look at the guide: Terminate an Amazon EC2 instance - Parameters:
- instance_id – ID of the instance to be terminated. 
- aws_conn_id – The Airflow connection used for AWS credentials. If this is - Noneor empty then the default boto3 behaviour is used. If running Airflow in a distributed manner and aws_conn_id is None or empty, then default boto3 configuration would be used (and must be maintained on each worker node).
- region_name – AWS region_name. If not specified then the default boto3 behaviour is used. 
- verify – Whether or not to verify SSL certificates. See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html 
- poll_interval (int) – Number of seconds to wait before attempting to check state of instance. Only used if wait_for_completion is True. Default is 20. 
- max_attempts (int) – Maximum number of attempts when checking state of instance. Only used if wait_for_completion is True. Default is 20. 
- wait_for_completion (bool) – If True, the operator will wait for the instance to be in the terminated state before returning. 
 
 - template_fields: collections.abc.Sequence[str][source]¶
 
- class airflow.providers.amazon.aws.operators.ec2.EC2RebootInstanceOperator(*, instance_ids, poll_interval=20, max_attempts=20, wait_for_completion=False, **kwargs)[source]¶
- Bases: - airflow.providers.amazon.aws.operators.base_aws.AwsBaseOperator[- airflow.providers.amazon.aws.hooks.ec2.EC2Hook]- Reboot Amazon EC2 instances. - See also - For more information on how to use this operator, take a look at the guide: Reboot an Amazon EC2 instance - Parameters:
- instance_ids (str | list[str]) – ID of the instance(s) to be rebooted. 
- aws_conn_id – The Airflow connection used for AWS credentials. If this is - Noneor empty then the default boto3 behaviour is used. If running Airflow in a distributed manner and aws_conn_id is None or empty, then default boto3 configuration would be used (and must be maintained on each worker node).
- region_name – AWS region_name. If not specified then the default boto3 behaviour is used. 
- verify – Whether or not to verify SSL certificates. See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html 
- poll_interval (int) – Number of seconds to wait before attempting to check state of instance. Only used if wait_for_completion is True. Default is 20. 
- max_attempts (int) – Maximum number of attempts when checking state of instance. Only used if wait_for_completion is True. Default is 20. 
- wait_for_completion (bool) – If True, the operator will wait for the instance to be in the running state before returning. 
 
 - template_fields: collections.abc.Sequence[str][source]¶
 
- class airflow.providers.amazon.aws.operators.ec2.EC2HibernateInstanceOperator(*, instance_ids, poll_interval=20, max_attempts=20, wait_for_completion=False, **kwargs)[source]¶
- Bases: - airflow.providers.amazon.aws.operators.base_aws.AwsBaseOperator[- airflow.providers.amazon.aws.hooks.ec2.EC2Hook]- Hibernate Amazon EC2 instances. - See also - For more information on how to use this operator, take a look at the guide: Hibernate an Amazon EC2 instance - Parameters:
- instance_ids (str | list[str]) – ID of the instance(s) to be hibernated. 
- aws_conn_id – The Airflow connection used for AWS credentials. If this is - Noneor empty then the default boto3 behaviour is used. If running Airflow in a distributed manner and aws_conn_id is None or empty, then default boto3 configuration would be used (and must be maintained on each worker node).
- region_name – AWS region_name. If not specified then the default boto3 behaviour is used. 
- verify – Whether or not to verify SSL certificates. See: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/core/session.html 
- poll_interval (int) – Number of seconds to wait before attempting to check state of instance. Only used if wait_for_completion is True. Default is 20. 
- max_attempts (int) – Maximum number of attempts when checking state of instance. Only used if wait_for_completion is True. Default is 20. 
- wait_for_completion (bool) – If True, the operator will wait for the instance to be in the stopped state before returning. 
 
 - template_fields: collections.abc.Sequence[str][source]¶