toil.lib.aws.ami

Module Contents

Functions

get_flatcar_ami(ec2_client[, architecture])

Retrieve the flatcar AMI image to use as the base for all Toil autoscaling instances.

flatcar_release_feed_amis(region[, architecture, source])

Yield AMI IDs for the given architecture from the Flatcar release feed.

feed_flatcar_ami_release(ec2_client[, architecture, ...])

Check a Flatcar release feed for the latest flatcar AMI.

aws_marketplace_flatcar_ami_search(ec2_client[, ...])

Query AWS for all AMI names matching Flatcar-stable-* and return the most recent one.

Attributes

logger

toil.lib.aws.ami.logger
toil.lib.aws.ami.get_flatcar_ami(ec2_client, architecture='amd64')

Retrieve the flatcar AMI image to use as the base for all Toil autoscaling instances.

AMI must be available to the user on AWS (attempting to launch will return a 403 otherwise).

Priority is:
  1. User specified AMI via TOIL_AWS_AMI

  2. Official AMI from stable.release.flatcar-linux.net

  3. Search the AWS Marketplace

If all of these sources fail, we raise an error to complain.

Parameters:
  • ec2_client (botocore.client.BaseClient) – Boto3 EC2 Client

  • architecture (str) – The architecture type for the new AWS machine. Can be either amd64 or arm64

Return type:

str

toil.lib.aws.ami.flatcar_release_feed_amis(region, architecture='amd64', source='stable')

Yield AMI IDs for the given architecture from the Flatcar release feed.

Parameters:
  • source (str) – can be set to a Flatcar release channel (‘stable’, ‘beta’, or ‘alpha’), ‘archive’ to check the Internet Archive for a feed, and ‘toil’ to check if the Toil project has put up a feed.

  • region (str) –

  • architecture (str) –

Return type:

Iterator[str]

Retries if the release feed cannot be fetched. If the release feed has a permanent error, yields nothing. If some entries in the release feed are unparseable, yields the others.

toil.lib.aws.ami.feed_flatcar_ami_release(ec2_client, architecture='amd64', source='stable')

Check a Flatcar release feed for the latest flatcar AMI.

Verify it’s on AWS.

Parameters:
  • ec2_client (botocore.client.BaseClient) – Boto3 EC2 Client

  • architecture (str) – The architecture type for the new AWS machine. Can be either amd64 or arm64

  • source (str) – can be set to a Flatcar release channel (‘stable’, ‘beta’, or ‘alpha’), ‘archive’ to check the Internet Archive for a feed, and ‘toil’ to check if the Toil project has put up a feed.

Return type:

Optional[str]

Query AWS for all AMI names matching Flatcar-stable-* and return the most recent one.

Parameters:
  • ec2_client (botocore.client.BaseClient) –

  • architecture (str) –

Return type:

Optional[str]