  def AttachInstanceProfileToRole(self,
    instance_profile_name: str,
    role_name: str) -> None:
    """Attach a role to an instance profile.

    Args:
      instance_profile_name: The name fo the instance profile.
      role_name: The role name.
    """
    logger.info('Attaching role {0:s} to instance profile {1:s}'
      .format(role_name, instance_profile_name))
    try:
      self.client.add_role_to_instance_profile(
        InstanceProfileName=instance_profile_name, RoleName=role_name)
    except self.client.exceptions.LimitExceededException:
      # pylint: disable=line-too-long
      logger.info('Instance profile {0:s} already has a role attached. Proceeding on assumption this is the correct attachment'
      # pylint: enable=line-too-long
        .format(instance_profile_name))
Attach a role to an instance profile.

Args:
instance_profile_name: The name fo the instance profile.
role_name: The role name.
libcloudforensics/providers/aws/internal/iam.py