def start_sp(): ami = core.get_image("SP2013 Demo") s = core.get_instance(core.start_spot( ami.id, "m1.large", placement="us-east-1c")) core.wait_running(s) core.set_name( s, "SP2013" ) return s
#!/usr/bin/python if __name__ == "__main__": import core core.init() def terminate(image_id): i = core.ec2.get_all_instances(filters= { 'image-id': image_id }) [y.terminate() for x in i for y in x.instances if y.state == 'running' ] selenium_id = core.get_image("selenium") [terminate(x) for x in ('ami-c5a675ac', 'ami-7fe23216', 'ami-4be23222', selenium_id.id)] [core.ec2.disassociate_address(association_id = x.association_id) for x in core.ec2.get_all_addresses() if x.association_id] [core.ec2.release_address(allocation_id = x.allocation_id) for x in core.ec2.get_all_addresses() if x.allocation_id]
#!/usr/bin/python import core import os if __name__ == "__main__": core.init() img = core.get_image("selenium") spot = core.start_spot(img.id, 'm1.small') inst_id = core.get_instance( spot ) core.wait_running( inst_id ) inst = core.get_instance_by_id(inst_id) os.system("cli53 rrcreate quest.com selenium A %s --replace" % inst.private_ip_address) core.log( 'selenium started at %s' % inst.public_dns_name )
def user(username): user = User.query.filter_by(username=username).first_or_404() core.get_image(user) return render_template('user.html', user=user)