def up_ec2(connection,<EOL>region,<EOL>instance_id,<EOL>wait_for_ssh_available=True,<EOL>log=False,<EOL>timeout=<NUM_LIT>):
<EOL>instance = connection.start_instances(instance_ids=instance_id)[<NUM_LIT:0>]<EOL>instance.update()<EOL>while instance.state != "<STR_LIT>" and timeout > <NUM_LIT:1>:<EOL><INDENT>log_yellow("<STR_LIT>" % instance.state)<EOL>if log:<EOL><INDENT>log_yellow("<STR_LIT>" % instance.state)<EOL><DEDENT>sleep(<NUM_LIT:10>)<EOL>timeout = timeout - <NUM_LIT:10><EOL>instance.update()<EOL><DEDENT>if wait_for_ssh_available:<EOL><INDENT>wait_for_ssh(instance.ip_address)<EOL><DEDENT>
boots an existing ec2_instance