diff --git a/monkey/monkey_island/cc/services/aws/aws_service.py b/monkey/monkey_island/cc/services/aws/aws_service.py index 39ac8b49b..5a6151580 100644 --- a/monkey/monkey_island/cc/services/aws/aws_service.py +++ b/monkey/monkey_island/cc/services/aws/aws_service.py @@ -84,15 +84,13 @@ class AWSService: results_queue = Queue() command_threads = [] for i in instances: - command_threads.append( - Thread( - target=self._run_agent_on_managed_instance, - args=(results_queue, i["instance_id"], i["os"], island_ip), - daemon=True, - ) + t = Thread( + target=self._run_agent_on_managed_instance, + args=(results_queue, i["instance_id"], i["os"], island_ip), + daemon=True, ) - - [thread.start() for thread in command_threads] + t.start() + command_threads.append(t) for thread in command_threads: thread.join()