toil.lib.aws

Submodules

Package Contents

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 Boto config file, 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])

Attributes

logger

toil.lib.aws.logger
toil.lib.aws.get_current_aws_region()[source]

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

Get the AWS zone from TOIL_AWS_ZONE if set.

Return type:

Optional[str]

toil.lib.aws.get_aws_zone_from_metadata()[source]

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

Get the AWS zone from the Boto config file, if it is configured and the boto module is available.

Return type:

Optional[str]

toil.lib.aws.get_aws_zone_from_environment_region()[source]

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

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 None if no method can produce a zone to use.

Return type:

Optional[str]

toil.lib.aws.zone_to_region(zone)[source]

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

Parameters:

zone (str)

Return type:

str

toil.lib.aws.running_on_ec2()[source]

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

Return type:

bool

toil.lib.aws.running_on_ecs()[source]

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)[source]
Parameters:

environment (MutableMapping[str, str])

Return type:

Dict[str, str]