airflow.contrib.hooks.aws_hook

Module Contents

airflow.contrib.hooks.aws_hook._parse_s3_config(config_file_name, config_format='boto', profile=None)[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

class airflow.contrib.hooks.aws_hook.AwsHook(aws_conn_id='aws_default', verify=None)[source]

Bases:airflow.hooks.base_hook.BaseHook

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

_get_credentials(self, region_name)[source]
get_client_type(self, client_type, region_name=None, config=None)[source]
get_resource_type(self, resource_type, region_name=None, config=None)[source]
get_session(self, region_name=None)[source]

Get the underlying boto3.session.

get_credentials(self, region_name=None)[source]

Get the underlying botocore.Credentials object.

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

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