airflow.providers.amazon.aws.hooks.base_aws

This module contains Base AWS Hook.

See also

For more information on how to use this hook, take a look at the guide: Amazon Web Services Connection

Module Contents

Classes

AwsBaseHook

Interact with AWS.

class airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook(aws_conn_id: Optional[str] = default_conn_name, verify: Union[bool, str, None] = None, region_name: Optional[str] = None, client_type: Optional[str] = None, resource_type: Optional[str] = None, config: Optional[botocore.config.Config] = None)[source]

Bases: airflow.hooks.base.BaseHook

Interact with AWS. This class is a thin wrapper around the boto3 python library.

Parameters
conn_name_attr = aws_conn_id[source]
default_conn_name = aws_default[source]
conn_type = aws[source]
hook_name = Amazon Web Services[source]
get_client_type(self, client_type: Optional[str] = None, region_name: Optional[str] = None, config: Optional[botocore.config.Config] = None) boto3.client[source]

Get the underlying boto3 client using boto3 session

get_resource_type(self, resource_type: Optional[str] = None, region_name: Optional[str] = None, config: Optional[botocore.config.Config] = None) boto3.resource[source]

Get the underlying boto3 resource using boto3 session

conn(self) Union[boto3.client, boto3.resource][source]

Get the underlying boto3 client/resource (cached)

Returns

boto3.client or boto3.resource

Return type

Union[boto3.client, boto3.resource]

get_conn(self) Union[boto3.client, boto3.resource][source]

Get the underlying boto3 client/resource (cached)

Implemented so that caching works as intended. It exists for compatibility with subclasses that rely on a super().get_conn() method.

Returns

boto3.client or boto3.resource

Return type

Union[boto3.client, boto3.resource]

get_session(self, region_name: Optional[str] = None) boto3.session.Session[source]

Get the underlying boto3.session.

get_credentials(self, region_name: Optional[str] = None) botocore.credentials.ReadOnlyCredentials[source]

Get the underlying botocore.Credentials object.

This contains the following authentication attributes: access_key, secret_key and token.

expand_role(self, role: str, region_name: Optional[str] = None) str[source]

If the IAM role is a role name, get the Amazon Resource Name (ARN) for the role. If IAM role is already an IAM role ARN, no change is made.

Parameters
  • role -- IAM role name or ARN

  • region_name -- Optional region name to get credentials for

Returns

IAM role ARN

static retry(should_retry: Callable[[Exception], bool])[source]

A decorator that provides a mechanism to repeat requests in response to exceeding a temporary quote limit.

Was this entry helpful?