Sign in
agent:

Check if an instance is running

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

Given an instance ID, this command will check if it is in a running state.

cmd = f'aws ec2 describe-instances --instance-ids {instance_id} --query "Reservations[].Instances[].State.Name" --output text' op = _exe(None, cmd) _problem = True if "running" in op: _problem = False _proceed = not _problem host_is_up = not _problem print(host_is_up)
copied
  1. 1

    Start the host if it is down

    There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.
    if not host_is_up: cmd = f'aws ec2 start-instances --instance-ids {instance_id}' op = _exe(None, cmd) print(op)
    copied
    1