class genvid.toolbox.AWSTool(**kwargs)

Bases: genvid.toolbox.basetool.BaseTool

A set of utilities to access and manipulate AWS cluster resources.

AMI_NAME_RE = re.compile('(?P<prefix>.*)-(?P<type>[^-]*)-(?P<version>[^-]*)-(?P<timestamp>\\d{8}-\\d{6})')

Regex to match an AMI.

AMI_NAME_TMPL = '{prefix}-{type}-{version}-{timestamp}'

Template of the AMI name.

DESCRIPTION = 'Utilities to access and manipulated AWS resources.'
NAME = 'aws'
aws_copy_ami(ami_id, regions, public=False, force=False)

Copy an AMI identified by ami_id to different regions. The AMI tags will be copied. If public is set to True, all AMI (including the src AMI) will be made public.


A default EC2 resource.

aws_list_amis(ami_type: str, owner: str = '', prefix: str = '', version: str = '')

List the available AMIs.

  • ami_type (str) – The type of AMI. Can be wingame or server.
  • owner (str) – If provided, filter by owner. The value genvidtech is a special alias for the Genvid Technologies Account.
  • prefix (str) – Prefix to filter. Can be ‘*’. If None, it will be either default for the Wingame AMI or genvidtech otherwise.
  • version (str) – Version to filter. Default to GENVID_TOOLBOX_VERSION.

A list of EC2 Images.

static aws_publish_image(ami)

Make the AMI public.

aws_rename_ami(ami_id, prefix, public=False, force=False)

Copy an AMI and change its initial prefix.

The name must match the AMI_NAME_RE and formatted with the AMI_NAME_TMPL. The AMI will be made public if public is True.


A default S3 resource.

aws_tag_ami_snapshot(ami, ec2=None)

Tag the AMI Snapshots with the same tags as the AMI.

The tags copied are the Name, Version, and InstanceType.

aws_upload_file(bucket: str, path: str, filepath: str)
generate_rsa_keypair(length: int)

Generate an RSA’s key pair.

Parameters:length – The length of the RSA key.
Returns:A tuple of the private key in PEM format and the public key in OpenSSH format.
get_s3_images_bucket_config(bucket: str, path='/') → dict

Get a list of images configuration from the bucket. The image name must match DockerTool.RE_IMAGE_IMAGEID.

  • bucket – The bucket to use.
  • path – The path for the bucket. Default to ‘/’.
update_s3_images(prefixes: typing.List[str], bucket, path)

Update images to S3

  • prefixes – Update only files with these prefixes.
  • bucket – The name of the bucket.
  • path – The prefix key where to upload the files.
class aws.AWSTool

Implementation of genvid.toolbox.AWSTool