code: def terminate_instance(
      self,
      instance_id: str,
      region: str,
      backend_data: Optional[str] = None,
  ):
      client = self.session.client("ec2", region_name=region)
      try:
          client.terminate_instances(InstanceIds=[instance_id])
      except botocore.exceptions.ClientError as e:
          if (
              e.response["Error"]["Code"]
              == "InvalidInstanceID.NotFound"
          ):
              pass
          else:
              raise e
  
imports: from concurrent.futures import ThreadPoolExecutor, as_completed
  from typing import Dict, List, Optional
  import boto3
  import botocore.client
  import botocore.exceptions
  import dstack._internal.core.backends.aws.resources
  import dstack.version
  from dstack._internal import settings
  from dstack._internal.core.backends.aws.config import AWSConfig
  from dstack._internal.core.backends.base.compute import Compute, get_gateway_user_data, get_instance_name, get_user_data
  from dstack._internal.core.backends.base.offers import get_catalog_offers
  from dstack._internal.core.errors import NoCapacityError
  from dstack._internal.core.models.backends.aws import AWSAccessKeyCreds
  from dstack._internal.core.models.backends.base import BackendType
  from dstack._internal.core.models.instances import InstanceAvailability, InstanceOffer, InstanceOfferWithAvailability, InstanceState, LaunchedGatewayInfo, LaunchedInstanceInfo
  from dstack._internal.core.models.runs import Job, Requirements, Run
  from dstack._internal.utils.logging import get_logger
label_desc: Use image node_id 4 for calling the AWSCompute obj's underlying member method code with example usage: obj.terminate_instance(instance_id, region, backend_data) without return types