After decades of fast development in Cyber–Physical System (CPS), CPS services are becoming more and more ubiquitous. While, the still growing trends on ambient intelligence asks for more smart CPS applications. Meanwhile, fog computing may also exhibit advantage on the energy efficiency as the fog nodes are distributed in the environment and can harvest green energy from the environment. Fog computing has been regarded as an ideal platform for the distributed and diverse CPS applications. In this paper, we are motivated to investigate how to explore the energy generation diversity in fog computing platform to achieve energy efficient service composition in a green energy powered Cyber–Physical Fog System (CPFS), with the joint consideration of source rate control, load balancing and service replica deployment. The energy efficiency problem is formulated as a mixed integer linear programming (MILP) and proved as NP-hard. To address the computation complexity, we further propose a heuristic algorithm. Extensive simulation studies are conducted and the results show the high energy efficiency of our algorithm by the fact it performs much close to the optimal solution.