agent: |
wQYav3PfBN7WsOlqiLE0Check if an instance is running
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.
inputs
outputs
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
- 1qc7tj24vkLzZuYWbHhhAStart the host if it is down
1
There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.inputsoutputsif not host_is_up: cmd = f'aws ec2 start-instances --instance-ids {instance_id}' op = _exe(None, cmd) print(op)copied1