def start_remote_server(region='eu-central-1'): broadcast("The server is starting") ec2=aws.resource('ec2', region_name=region) instance=ec2.create_instances( ImageId=ami, MinCount=1, MaxCount=1, KeyName='minecraftsyd', SecurityGroups=['mc'], InstanceType='r3.large', InstanceInitiatedShutdownBehavior='terminate')[0] server_id = instance.id server_region=region instance.wait_until_running() instance=ec2.Instance(id=instance.id) print "updating ovh to "+instance.public_dns_name msmupdatedns.update(instance.public_dns_name+".") started=True broadcast("The server is started, and available in up to 60 seconds")
def check_server_status(): ec2=aws.resource('ec2', region_name=server_region) instance=ec2.Instance(id=server_id) if instance.state['Code'] == 16: broadcast("The server is already started, please try again soon") broadcast("or use this ip: "+instance.public_ip_address+" while the dns cache refreshes.") msmupdatedns.update(instance.public_dns_name) else: broadcast("Server not running anymore, will start a new one") started=False server_id=None server_region=None
def check_server_status(): ec2 = aws.resource('ec2', region_name=server_region) instance = ec2.Instance(id=server_id) if instance.state['Code'] == 16: broadcast("The server is already started, please try again soon") broadcast("or use this ip: " + instance.public_ip_address + " while the dns cache refreshes.") msmupdatedns.update(instance.public_dns_name) else: broadcast("Server not running anymore, will start a new one") started = False server_id = None server_region = None
def start_remote_server(region='eu-central-1'): broadcast("The server is starting") ec2 = aws.resource('ec2', region_name=region) instance = ec2.create_instances( ImageId=ami, MinCount=1, MaxCount=1, KeyName='minecraftsyd', SecurityGroups=['mc'], InstanceType='r3.large', InstanceInitiatedShutdownBehavior='terminate')[0] server_id = instance.id server_region = region instance.wait_until_running() instance = ec2.Instance(id=instance.id) print "updating ovh to " + instance.public_dns_name msmupdatedns.update(instance.public_dns_name + ".") started = True broadcast("The server is started, and available in up to 60 seconds")