toil.lib.aws

Submodules

Attributes

AWSRegionName

AWSServerErrors

logger

Functions

get_current_aws_region()

Return the AWS region that the currently configured AWS zone (see

get_aws_zone_from_environment()

Get the AWS zone from TOIL_AWS_ZONE if set.

get_aws_zone_from_metadata()

Get the AWS zone from instance metadata, if on EC2 and the boto module is

get_aws_zone_from_boto()

Get the AWS zone from the Boto3 config file or from AWS_DEFAULT_REGION, if it is configured and the

get_aws_zone_from_environment_region()

Pick an AWS zone in the region defined by TOIL_AWS_REGION, if it is set.

get_current_aws_zone()

Get the currently configured or occupied AWS zone to use.

zone_to_region(zone)

Get a region (e.g. us-west-2) from a zone (e.g. us-west-1c).

running_on_ec2()

Return True if we are currently running on EC2, and false otherwise.

running_on_ecs()

Return True if we are currently running on Amazon ECS, and false otherwise.

build_tag_dict_from_env([environment])

Package Contents

toil.lib.aws.AWSRegionName
toil.lib.aws.AWSServerErrors
toil.lib.aws.logger
toil.lib.aws.get_current_aws_region()

Return the AWS region that the currently configured AWS zone (see get_current_aws_zone()) is in.

Return type:

Optional[str]

toil.lib.aws.get_aws_zone_from_environment()

Get the AWS zone from TOIL_AWS_ZONE if set.

Return type:

Optional[str]

toil.lib.aws.get_aws_zone_from_metadata()

Get the AWS zone from instance metadata, if on EC2 and the boto module is available. Otherwise, gets the AWS zone from ECS task metadata, if on ECS.

Return type:

Optional[str]

toil.lib.aws.get_aws_zone_from_boto()

Get the AWS zone from the Boto3 config file or from AWS_DEFAULT_REGION, if it is configured and the boto3 module is available.

Return type:

Optional[str]

toil.lib.aws.get_aws_zone_from_environment_region()

Pick an AWS zone in the region defined by TOIL_AWS_REGION, if it is set.

Return type:

Optional[str]

toil.lib.aws.get_current_aws_zone()

Get the currently configured or occupied AWS zone to use.

Reports the TOIL_AWS_ZONE environment variable if set.

Otherwise, if we have boto and are running on EC2, or if we are on ECS, reports the zone we are running in.

Otherwise, if we have the TOIL_AWS_REGION variable set, chooses a zone in that region.

Finally, if we have boto2, and a default region is configured in Boto 2, chooses a zone in that region.

Returns ‘us-east-1a’ if no method can produce a zone to use.

Return type:

Optional[str]

toil.lib.aws.zone_to_region(zone)

Get a region (e.g. us-west-2) from a zone (e.g. us-west-1c).

Parameters:

zone (str)

Return type:

AWSRegionName

toil.lib.aws.running_on_ec2()

Return True if we are currently running on EC2, and false otherwise.

Return type:

bool

toil.lib.aws.running_on_ecs()

Return True if we are currently running on Amazon ECS, and false otherwise.

Return type:

bool

toil.lib.aws.build_tag_dict_from_env(environment=os.environ)
Parameters:

environment (MutableMapping[str, str])

Return type:

Dict[str, str]