AbstractThe number of computing resources required for high‐volume applications is ever‐increasing. As far as the users' requests generate workload variations over time and the resources of cloud servers that respond to the requests are limited, the quality of services (QoS) of the cloud server is experiencing fluctuations. The cloud federation is a place where the cloud service providers work together to overcome the problem of resource scarcity and poor service quality. As a result, the main aim of forming a cloud federation is to create an optimal one in a way that provides the required resources and QoS for customers and maximum profit for the providers. Since the service providers play a key role in cloud federation formation, and their absence deteriorates the QoS of the federation, it is required to form an optimal cloud federation that provides the best profit for service providers to encourage them to remain in the federation. In the present paper, first, a model will be introduced for evaluating the cloud service providers, inspired by the concepts of macroeconomics. Then a greedy algorithm will be presented for forming an optimal federation. The proposed algorithm uses the evaluation results to rank the service providers and selects the best federation based on this ranking. In addition, the reputation of providers is evaluated based on the proposed method, which is a criterion for introducing the best providers. Furthermore, the surplus shared resources of the providers will be determined using the evaluation results and its optimal value will be proposed to cloud service providers using the proposed method. Finally, a set of tests will be performed on the introduced system.