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

class airflow.providers.amazon.aws.hooks.base_aws._SessionFactory(conn: Connection, region_name: Optional[str], config: Config)[source]

Bases: airflow.utils.log.logging_mixin.LoggingMixin

create_session(self)[source]

Create AWS session.

_create_basic_session(self, session_kwargs: Dict[str, Any])[source]
_impersonate_to_role(self, role_arn: str, session: boto3.session.Session, session_kwargs: Dict[str, Any])[source]
_read_role_arn_from_extra_config(self)[source]
_read_credentials_from_connection(self)[source]
_assume_role(self, sts_client: boto3.client, role_arn: str, assume_role_kwargs: Dict[str, Any])[source]
_assume_role_with_saml(self, sts_client: boto3.client, role_arn: str, assume_role_kwargs: Dict[str, Any])[source]
_fetch_saml_assertion_using_http_spegno_auth(self, saml_config: Dict[str, Any])[source]
_assume_role_with_web_identity(self, role_arn, assume_role_kwargs, base_session)[source]
_get_google_identity_token_loader(self)[source]
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[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_credentials(self, region_name: Optional[str])[source]
get_client_type(self, client_type: str, region_name: Optional[str] = None, config: Optional[Config] = None)[source]

Get the underlying boto3 client using boto3 session

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

Get the underlying boto3 resource using boto3 session

conn(self)[source]

Get the underlying boto3 client/resource (cached)

Returns

boto3.client or boto3.resource

Return type

Union[boto3.client, boto3.resource]

get_conn(self)[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)[source]

Get the underlying boto3.session.

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

Get the underlying botocore.Credentials object.

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

expand_role(self, role: 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

Returns

IAM role ARN

airflow.providers.amazon.aws.hooks.base_aws._parse_s3_config(config_file_name: str, config_format: Optional[str] = 'boto', profile: Optional[str] = None) → Tuple[Optional[str], Optional[str]][source]
Parses a config file for s3 credentials. Can currently
parse boto, s3cmd.conf and AWS SDK config formats
Parameters
  • config_file_name (str) -- path to the config file

  • config_format (str) -- config type. One of "boto", "s3cmd" or "aws". Defaults to "boto"

  • profile (str) -- profile name in AWS type config file

Was this entry helpful?