Cloud computing has recently emerged as a dominant Internet service computing model due to its "payas-you-go" and "elastic service" features. Cloud computing systems are usually composed of distributed datacenters, which leverage virtualization technology to provide a scalable and reliable service. Optical networks are recognized as promising next-generation core networks for connecting these distributed datacenters due to their characteristics such as high bandwidth provisioning, low latency, low bit error rate, etc. However, concern about the ever-increasing energy consumption of cloud computing systems together with core networks has been raised due to high electricity bills as well as environmental pollution. In this paper, we study the Energy-aware Provisioning in Optical Cloud Networks (EPOCN) problem for both dynamic and static cases. When traffic requests arrive in an online fashion, we propose a polynomial-time energy-aware routing algorithm to solve the dynamic EPOCN problem. Simulations show that our energy-aware routing algorithm brings more energy savings in comparison to a shortest path-based routing algorithm and a traffic grooming algorithm. On the other hand, we show that the EPOCN problem in the static case (the traffic matrix is known in advance) is NP-hard. We further divide this problem into (1) the Energy-Aware Routing (EAR) problem in optical networks and (2) the Energy-efficient Server and Switch Allocation (ESSA) problem in datacenter networks. Considering these two (sub)problems are still NP-hard, we present an exact Integer Linear Program (ILP) and a heuristic to solve each problem. We also conduct simulations to compare the proposed ILPs and heuristics in terms of energy consumption and running time. (C) 2017 Elsevier B.V. All rights reserved.