To reduce cost and emission, modern datacenter operators are beginning to incorporate green energy sources into data- centers' power supply. To improve service availability, they also back up datacenters using traditional (usually brown) energy sources. However, challenge arises due to distinct characteristics of energy sources used for different goals. How to select optimal energy sources and plan their capacity for datacenters to meet cost, emission and service availabil- ity requirement remains an open research problem. In this extended abstract, we briefly describe recent work in , which provides a holistic solution to address this problem. In , we present GreenPlanning, a framework to strike a judicious balance among multiple energy sources, the elec- trical grid and energy storage devices for a datacenter in terms of cost, emission, and service availability. GreenPlan- ning explores different features and operations of both green and traditional energy sources available to datacenters. The framework minimizes the lifetime total cost including both capital and operational cost for a datacenter. We conduct extensive experiments to evaluate GreenPlanning with real- life computational workload and meteorological data traces. Results demonstrate that GreenPlanning can reduce the life- time total cost and emission by more than 50% compared to traditional configurations without integration of green en- ergy, while still meeting service availability requirement.