Sign in

Get instance id of a hostname

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

This task just gets the ec2 instance id for a given host based on the label.

cmd = f'aws ec2 describe-instances --filters "Name=tag:Name,Values={hostname}" --query "Reservations[].Instances[].InstanceId" --output text' op = _exe(None, cmd) instance_id = op.strip() context.problem = True print(f"Instance id for {hostname} is {instance_id}")
copied