—Real-time prediction of communications (or road) traffic by using cloud computing and sensor data collected by Internet-of-Things (IoT) devices would be very useful application of big-data analytics. However, upstream data flow from IoT devices to the cloud server could be problematic, even in fifth generation (5G) networks, because networks have mainly been designed for downstream data flows like for video delivery. This paper proposes a framework in which a software defined network (SDN), edge server, and cloud server cooperate with each other to control the upstream flow to maintain the accuracy of the real-time predictions under the condition of a limited network bandwidth. The framework consists of a system model, methods of prediction and determining the importance of data using machine learning, and a mathematical optimization. Our key idea is that the SDN controller optimizes data flows in the SDN on the basis of feature importance scores, which indicate the importance of the data in terms of the prediction accuracy. The feature importance scores are extracted from the prediction model by a machine-learning feature selection method that has traditionally been used to suppress effects of noise or irrelevant input variables. Our framework is examined in a simulation study using a real dataset consisting of mobile traffic logs. The results validate the framework; it maintains prediction accuracy under the constraint of limited available network bandwidth. Potential applications are also discussed.