Wireless sensor networks (WSNs) connect hundreds or thousands of physically separate sensor nodes (or "motes") to gather data from all over a given area. The medical monitoring sector, the weather service, government and military applications, and many more all use WSNs for data collecting. The limitations of WSNs in terms of processing speed, data storage capacity, and power availability all present challenges. Due to the rise of Cloud computing and all the advantages it brings, the idea of combining the two systems has been proposed. The proposed system provides a fresh approach to how WSNs might link up with the Cloud. Using Cloud computing, this research provides a unified WSN for environmental surveillance. The primary goal is to provide a robust and astute infrastructure for the constant flow of sensor data. To do this, the WSN will collect data from its immediate vicinity, compress it, and then relay it via a gateway, which will then expand it and store it in the Cloud server. Both the opportunities and limitations of the WSN, including security concerns and Cloud computing services, will be discussed in this article. Therefore, a hierarchical structure of coded probable blue fish cryptosystem has been constructed in the design of data aggregation in WSN and the Distributed optimized LEACH (DO LEACH) protocol can deal with the restricted resources of the nodes and the route selection necessary for Cloud integration. The bio-inspired compressed cuckoo optimization technique was utilized to fine-tune the protocols. It should be evident by the completion of the article how well the proposed security protocols may maintain the network's total energy by decreasing the energy consumption of individual nodes, all while enabling reliable secure transmission between Wireless Sensor Networks and Cloud servers.