code: def main():
      all_instance_types = set()
  
      instance_types_map_str = ""
      instance_region_map_str = ""
      nlb_region_map_str = ""
      elb_region_map_str = ""
      nat_region_map_str = ""
      ebs_region_map_str = ""
      eks_region_map_str = ""
  
      for i, region in enumerate(sorted(REGIONS), start=1):
          print(
              "generating region {}/{} ({})...".format(
                  i, len(REGIONS), region
              )
          )
  
          response = requests.get(
              EC2_PRICING_ENDPOINT_TEMPLATE.format(region)
          )
          pricing = response.json()
  
          instance_types, instance_metadatas = get_instance_metadatas(
              pricing
          )
          nlb_metadata = get_nlb_metadata(pricing)
          elb_metadata = get_elb_metadata(pricing)
          nat_metadata = get_nat_metadata(pricing)
          ebs_metadata = get_ebs_metadata(pricing)
          eks_price = get_eks_price(region)
  
          all_instance_types.update(instance_types)
  
          instance_types_str = ""
          for instance_type in sorted(
              instance_types, key=instanceTypeSorter
          ):
              instance_types_str += f'"{instance_type}",\n'
  
          instance_metadatas_str = ""
          for instance_type in sorted(
              instance_metadatas.keys(), key=instanceTypeSorter
          ):
              metadata = instance_metadatas[instance_type]
              instance_metadatas_str += (
                  instance_metadata_template.substitute(
                      {
                          "region": region,
                          "type": instance_type,
                          "memory": metadata["mem"],
                          "cpu": metadata["cpu"],
                          "gpu": metadata["gpu"],
                          "inf": inf_per_instance_type.get(
                              instance_type, 0
                          ),
                          "price": metadata["price"],
                      }
                  )
              )
  
          ebs_metadatas_str = ""
  
          for ebs_type in sorted(ebs_metadata.keys()):
              metadata = ebs_metadata[ebs_type]
              ebs_metadatas_str += ebs_type_map_template.substitute(
                  {
                      "region": region,
                      "type": ebs_type,
                      "price_gb": metadata["price_gb"],
                      "price_iops": metadata["price_iops"],
                      "price_throughput": metadata["price_throughput"],
                      "iops_configurable": metadata[
                          "iops_configurable"
                      ],
                      "throughput_configurable": metadata[
                          "throughput_configurable"
                      ],
                  }
              )
  
          instance_types_map_str += (
              instance_types_map_template.substitute(
                  {
                      "region": region,
                      "instance_types": instance_types_str,
                  }
              )
          )
          instance_region_map_str += (
              instance_region_map_template.substitute(
                  {
                      "region": region,
                      "instance_metadatas": instance_metadatas_str,
                  }
              )
          )
          nlb_region_map_str += nlb_region_map_template.substitute(
              {"region": region, "price": nlb_metadata["price"]}
          )
          elb_region_map_str += elb_region_map_template.substitute(
              {"region": region, "price": elb_metadata["price"]}
          )
          nat_region_map_str += nat_region_map_template.substitute(
              {"region": region, "price": nat_metadata["price"]}
          )
          ebs_region_map_str += ebs_region_map_template.substitute(
              {"region": region, "ebs_metadata": ebs_metadatas_str}
          )
          eks_region_map_str += eks_region_map_template.substitute(
              {"region": region, "price": eks_price}
          )
  
      all_instance_types_str = ""
      for instance_type in sorted(
          all_instance_types, key=instanceTypeSorter
      ):
          all_instance_types_str += f'"{instance_type}",\n'
  
      file_str = file_template.substitute(
          {
              "all_instance_types": all_instance_types_str,
              "instance_types_map": instance_types_map_str,
              "instance_region_map": instance_region_map_str,
              "nlb_region_map": nlb_region_map_str,
              "elb_region_map": elb_region_map_str,
              "nat_region_map": nat_region_map_str,
              "ebs_region_map": ebs_region_map_str,
              "eks_region_map": eks_region_map_str,
          }
      )
  
      with open(OUTPUT_FILE_NAME, "w") as f:
          print("writing {}...".format(OUTPUT_FILE_NAME))
          f.write(file_str)
          print("✓ done")
  
file_path: cortex/pkg/lib/aws/gen_resource_metadata.py
imports: import requests
  import re
  from string import Template
label_desc: Use image node_id 8 for calling a global function with example usage: main() without return types