The Internet of Things (IoT) and cloud computing are new concepts in revolutionized communication and information technologies. Different technologies, for example, transportation and healthcare, can benefit from Cloud of Things (CloudIoT) for mobile and fixed resource applications with great promises. Fixed and mobile resources are very important items in the CloudIoT paradigm because of the need for an appropriate discovery mechanism. In the present study, a mathematical optimization model is proposed for the minimization of bandwidth, cost, and response time of CloudIoT platforms with a special focus on the role of mobile and fixed resources in resource discovery. Additionally, this study presents a heuristic resource discovery algorithm using a mathematical optimization model (RDMOM). The mixed‐integer non‐linear programming is used to design the discovery mechanism. Furthermore, the optimization problem is solved using the red deer algorithm. Finally, the simulation results show a significant reduction in the latency, resource efficiency, and energy consumption, as well as an improvement in availability and success ratio, compared to previous algorithms. The RDMOM algorithm significantly improves the success ratio, energy consumption, resource efficiency, availability, and latency, respectively, by 18%, 21%, 24%, 17%, and 21% in comparison to other algorithms.