The computing devices in cloud or fog data centers remain in the continuous running cycle to provide services. The long execution state of large number of computing devices consumes significant amount of power which emit equivalent amount of heat. The high powered cooling systems are installed for data centers to avoid reduced performance of the devices due to heat. In cloud based infrastructure, the longer response time between service provider and end-users is challenging for efficient power utilization in smart grid. In this paper, fog based model is proposed for a community to ensure real time energy management service provision with minimal network latency and efficient resource allocation technique. Moreover, a mechanism is proposed to calculate the energy demand for computing devices and cooling system for fog data center. In this paper, two scenarios are proposed to analyze the energy cost for a community and fog data center by integrating green power supply. The simulations show that green community with green fog is 15.09% more cost efficient as compared to the community with utility’s power supply only.