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)
| 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]: |