MCPcopy Create free account
hub / github.com/agenticsorg/edge-agents / terminate_instance

Method terminate_instance

scripts/agents/devops/src/aws/ec2.py:239–255  ·  view source on GitHub ↗

Terminate an EC2 instance. Args: instance_id: The ID of the instance to terminate. wait: Whether to wait for the instance to be terminated. Returns: Final instance details.

(self, instance_id: str, wait: bool = True)

Source from the content-addressed store, hash-verified

237
238 @aws_operation("terminate_instance")
239 def terminate_instance(self, instance_id: str, wait: bool = True) -> Dict[str, Any]:
240 """
241 Terminate an EC2 instance.
242
243 Args:
244 instance_id: The ID of the instance to terminate.
245 wait: Whether to wait for the instance to be terminated.
246
247 Returns:
248 Final instance details.
249 """
250 self.client.terminate_instances(InstanceIds=[instance_id])
251
252 if wait:
253 self.wait_for('instance_terminated', {'InstanceIds': [instance_id]})
254
255 return self.get_instance(instance_id)
256
257 @aws_operation("reboot_instance")
258 def reboot_instance(self, instance_id: str) -> Dict[str, Any]:

Callers 2

handle_ec2_commandFunction · 0.95
test_instance_lifecycleFunction · 0.80

Calls 2

get_instanceMethod · 0.95
wait_forMethod · 0.80

Tested by 1

test_instance_lifecycleFunction · 0.64