code: def create_iam_instance_profile(
      iam_client: botocore.client.BaseClient, project_id: str
  ) -> str:
      role_name = create_role_and_policy(iam_client, project_id)
  
      try:
          response = iam_client.get_instance_profile(
              InstanceProfileName=role_name
          )
          return response["InstanceProfile"]["Arn"]
      except botocore.exceptions.ClientError as e:
          if e.response["Error"]["Code"] != "NoSuchEntity":
              raise e
  
      response = iam_client.create_instance_profile(
          InstanceProfileName=role_name,
          Tags=[
              {"Key": "owner", "Value": "dstack"},
              {"Key": "dstack_project", "Value": project_id},
          ],
      )
      instance_profile_arn = response["InstanceProfile"]["Arn"]
      iam_client.add_role_to_instance_profile(
          InstanceProfileName=role_name,
          RoleName=role_name,
      )
      return instance_profile_arn
  
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 3 for calling a global function with example usage: create_iam_instance_profile(iam_client, project_id) and returns: instance_profile_arn, response