The energy spent on powering the global infor mation technology (IT) infrastructure has grown tremendously in the past decade, despite the dramatic improvement achieved in building energy efficient IT devices. In particular, reducing the high energy consumption of data centers has become a very important area due to the sudden popularity and demand for cloud computing services. In this paper, we propose to optimize the energy consumption in data centers by placing customers' virtual machines intelligently in the data center. We formulate this problem as a mathematical optimization problem and prove it's NP-hardness. We further explore two greedy approximation algorithms: the minimum power virtual machine (VM) placement algorithm (MinPow), that attempts to decrease the power consumption by avoiding powering up unnecessarily additional servers; and, the minimum communication virtual machine placement algorithm (Min Com), that aims at packing one user's VMs as much as possible on the same server or under the same rack to decrease the networking energy cost.We further, examine the performance of these two algorithms in both small scale and large scale clusters, and compare them to other alternatives. Our results demonstrate that MinPow and MinCom yield placements that are within 5% to 10% energy consumption of the optimal solution.