airflow.providers.amazon.aws.hooks.ec2
¶
Module Contents¶
-
class
airflow.providers.amazon.aws.hooks.ec2.
EC2Hook
(api_type='resource_type', *args, **kwargs)[source]¶ Bases:
airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook
Interact with AWS EC2 Service.
Additional arguments (such as
aws_conn_id
) may be specified and are passed down to the underlying AwsBaseHook.See also
-
get_instance
(self, instance_id: str, filters: list = None)[source]¶ Get EC2 instance by id and return it.
-
stop_instances
(self, instance_ids: list)[source]¶ Stop instances with given ids
- Parameters
instance_ids -- List of instance ids to stop
- Returns
Dict with key StoppingInstances and value as list of instances being stopped
-
start_instances
(self, instance_ids: list)[source]¶ Start instances with given ids
- Parameters
instance_ids -- List of instance ids to start
- Returns
Dict with key StartingInstances and value as list of instances being started
-
terminate_instances
(self, instance_ids: list)[source]¶ Terminate instances with given ids
- Parameters
instance_ids -- List of instance ids to terminate
- Returns
Dict with key TerminatingInstances and value as list of instances being terminated
-
describe_instances
(self, filters: list = None, instance_ids: list = None)[source]¶ Describe EC2 instances, optionally applying filters and selective instance ids
- Parameters
filters -- List of filters to specify instances to describe
instance_ids -- List of instance IDs to describe
- Returns
Response from EC2 describe_instances API
-
get_instances
(self, filters: list = None, instance_ids: list = None)[source]¶ Get list of instance details, optionally applying filters and selective instance ids
- Parameters
instance_ids -- List of ids to get instances for
filters -- List of filters to specify instances to get
- Returns
List of instances
-
get_instance_ids
(self, filters: list = None)[source]¶ Get list of instance ids, optionally applying filters to fetch selective instances
- Parameters
filters -- List of filters to specify instances to get
- Returns
List of instance ids
-