def down_ec2(instance_id, region, access_key_id, secret_access_key):
conn = connect_to_ec2(region, access_key_id, secret_access_key)<EOL>instance = conn.stop_instances(instance_ids=instance_id)[<NUM_LIT:0>]<EOL>while instance.state != "<STR_LIT>":<EOL><INDENT>log_yellow("<STR_LIT>" % instance.state)<EOL>sleep(<NUM_LIT:10>)<EOL>instance.update()<EOL><DEDENT>log_green('<STR_LIT>' % instance.state)<EOL>
shutdown of an existing EC2 instance