With the rapid pace in the evolution and development of technology, the demand of electrical energy is also increasing. Beside the production of energy from traditional and renewable energy sources, the energy management is also required to control the consumption of energy in commercial, industrial and residential houses. Improvement in technologies while reduction in cost has enabled consumers to interconnect the smart devices for reducing cost and energy consumption, this is called internet of things (IoTs). Such increase in the number of smart systems and energy management systems cause a huge amount of data which cannot be processed on traditional system. It requires high computing power and high storage which may be provided by cloud computing. Cloud computing provide resources to customers on demand with low investment and operational cost. The cloud resources are flexible, efficient , scalable and secure. In this paper we simulate the use of cloud computing in smart grid. The datacenters in cloud collect the building's data, process it and send the results to the building. In this study, we calculate the total response time to each building, the number of requests coming from each building per our, the processing time of each datacen-ter and the cost of each datacenter (CRRP). The results are useful for energy service providers to select the optimal processing and data storage resources.