The large amount of energy consumed by Internet services represents significant and fast-growing financial and environmental costs. Increasingly, services are exploring dynamic methods to minimize energy costs while respecting their service-level agreements (SLAs). Furthermore, it will soon be important for these services to manage their usage of “brown energy” (produced via carbon-intensive means) relative to renewable or “green” energy. This paper introduces a general, optimization-based framework for enabling multi-data-center services to manage their brown energy consumption and leverage green energy, while respecting their SLAs and minimizing energy costs. Based on the framework, we propose policies for request distribution across the data centers. Our policies can be used to abide by caps on brown energy consumption, such as those that might arise from Kyotostyle carbon limits, from corporate pledges on carbon-neutrality, or from limits imposed on services to encourage...