Energy cloud systems continue to shape the future of the energy sector. The complexity of energy cloud systems stems from their widespread and distributed aspects such as renewable energy sources, energy storage, customers engagement, social media and the advancements in communication and computing technologies. The unprecedented large-scale growth of energy cloud systems requires a crucial and dramatic paradigm shift in mana. Energy cloud systems continue to shape the future of the energy sector. The complexity of energy cloud systems stems from their widespread and distributed aspects such as renewable energy sources, energy storage, customers engagement, social media and the advancements in communication and computing technologies. The unprecedented large-scale growth of energy cloud systems requires a crucial and dramatic paradigm shift in managing and optimizing the available energy assets in order to satisfy the increasing customers' requirements. This paper proposes and evaluates an edge computing based framework that aims to efficiently manage and optimize energy cloud systems while increasing their reliability, safety, and security. The proposed framework exploits the current expansion in computing capabilities of the edge computing and the Fifth Communication Generation (5G) technology. The evaluation of the proposed framework shows that an edge computing infrastructure improves the service efficiency by 22.6% compared with a cloud infrastructure. In addition, the latency is reduced by 69.1%. The proposed framework provides threat detection capability by using the edge layer as an extra layer for defense against energy cloud system attacks. However, this defense mechanism incurs 10.9% overhead and 9.6% extra delay per service request on average.••••A framework to manage the energy cloud system using edge computing infrastructure.••Exploiting the capabilities of the emerging 5G communication technology to reduce the latency.••Using edge server's collaboration for better services quality.••Using privacy mediators and security information sharing for better energy cloud system security.Energy cloudEdge computing5GEnergy cloud securityEnergy cloud is a new energy platform that aims at replacing the current, centralized, static and “one-way hub-and-spoke” power grid. It relies on conventional energy generation resources like fossil fuel, hydro, or nuclear power plants with a dynamic and decentralized grid. The energy cloud is promoting new, clean, and distributed renewable energy resources such as solar, wind, heat power plants, energy storage, natural gas based generators and electrical vehicle charging infrastructure. Many of the distributed energy resources (DERs) have showed an exponential growth in the past few years which is expected to continue in the near future. The advancement in the DERs is accompanied by more active and socially connected customers who have different energy management requirements and consumption patterns,,.The old conventional customer-utilities relationship is going through a dramatic change. The one way relation, where a customer only consumes generated energy from the utility service providers, is changing to become a two ways interaction. The role of customers in the two ways interaction paradigm includes the consumption and generation of the energy. Additionally, customers sell the excessive generated energy to the power grid. The two ways interaction is driven by the emerging techniques like demand-side management,, s. 2.1. Energy cloud systemsRecently, the conventional one way power grid that is designed as a centralized power generation resources (e.g. power plants) is being transformed into a multi-ways network that consists of large scale installations of DERs. The new network of networks of energy systems around the globe has customers and DERs providers at the core of this emerging energy systems. In addition, metering technologies (both energy generation and storage) are being developed in an unprecedented pace and becoming essential components of today's power grid,. An energy cloud system provides a redefined energy sector platform that represents the future power grid where new products and business opportunities are promising. It relies on clean, decentralized and intelligent grid architecture. The transition from the old power grid infrastructure into the energy cloud platform will require the orchestration of its entities to achieve its objectives (e.g. reliability, safety and security). The energy cloud platform effectively addresses the current challenges within the energy sector where safety and cost concerns are continuously increasing,,. Building an efficient energy cloud system is a complex process that includes multiple challenges which are:••Large scale of energy cloud system deployment, orchestration and management complexity: The large scale distri.