genvid.toolbox.AWSTool¶
-
class
genvid.toolbox.
AWSTool
(**kwargs)¶ Bases:
genvid.toolbox.basetool.BaseTool
A set of utilities to access and manipulate cluster resources in AWS.
-
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.
-
aws_ec2
¶ A default EC2 resource.
-
aws_list_amis
(ami_type: str, owner: str = '', prefix: str = '', version: str = '')¶ List the available AMIs.
Parameters: - ami_type (str) – The type of ami. Can be
wingame
orserver
. - owner (str) – If provided, filter by owner. The value
genvidtech
is a special aliases for Genvid Technologies Account. - prefix (str) – prefix to filter. Can be ‘*’. If None,
will it be either
default
for the Wingame AMI, orgenvidtech
otherwise. - version (str) – Version to filter. Default to
GENVID_TOOLBOX_VERSION
Returns: A list of EC2 Images.
- ami_type (str) – The type of ami. Can be
-
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 will be format with theAMI_NAME_TMPL
. The AMI will be made public if public is True.
-
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.
-
generate_rsa_keypair
(length: int)¶ Generate a 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.
-