def reboot_instance(instance_id): ec2 = EC2Provider() return ec2.reboot_instance(instance_id)
def terminate_instance(instance_id): ec2 = EC2Provider() return ec2.delete_instance(instance_id)
def start_instance(instance_id): ec2 = EC2Provider() return ec2.start_instance(instance_id)
def from_instance_id(instance_id): return Instance.from_EC2Instance(EC2Provider().get_instance_by_id(instance_id))
def from_hostname(hostname): ec2 = EC2Provider() return Instance.from_EC2Instance(ec2.get_instances_by_tag("Name", hostname)[0])
def get_user_instances(creator): ec2 = EC2Provider() return [Instance.from_EC2Instance(inst) for inst in ec2.get_instances_by_tag('creator', creator)]
def __init__(self): self.provider = EC2Provider()