genvid.toolbox.AWSTool

class genvid.toolbox.AWSTool(**kwargs)

Bases: genvid.toolbox.basetool.BaseTool

A set of utilities to access and manipulate Genvid 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.

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 the AMI_NAME_TMLP. 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)

Generate a RSA’s key pair of lenght.

Return to byte arrays: the private key in PEM format, and the public key in OpenSSH format.