code: def get_gateway_image_id(
      ec2_client: botocore.client.BaseClient,
  ) -> str:
      response = ec2_client.describe_images(
          Filters=[
              {
                  "Name": "name",
                  "Values": [
                      "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"
                  ],
              },
              {
                  "Name": "owner-alias",
                  "Values": ["amazon"],
              },
          ],
      )
      image = sorted(
          response["Images"],
          key=lambda i: i["CreationDate"],
          reverse=True,
      )[0]
      return image["ImageId"]
  
file_path: dstack/src/dstack/_internal/core/backends/aws/resources.py
imports: import json
  from typing import Any, Dict, List, Optional
  import botocore.client
  import botocore.exceptions
  import dstack.version
  from dstack._internal.core.errors import ResourceNotFoundError
label_desc: Use image node_id 6 for calling a global function with example usage: get_gateway_image_id(ec2_client) and returns: image