###### Abstract  
The widespread adoption of Internet of Things (IoT) devices has significantly increased the exposure of cloud-based architectures to cybersecurity risks, particularly Distributed Denial-of-Service (DDoS) attacks. Traditional detection methods often fail to efficiently identify and mitigate these threats in dynamic IoT/Cloud environments. This study proposes a machine-learning-based framework to enhance DDoS attack detection and mitigation, employing Random Forest, XGBoost, and Long Short-Term Memory (LSTM) models. Two well-established datasets, CIC-DDoS2019 and N-BaloT, were used to train and evaluate the models, with feature selection techniques applied to optimize performance. A comparative analysis was conducted using key performance metrics, including accuracy, precision, recall, and F1-score. The results indicate that Random Forest outperforms other models, achieving a precision of 99.96% and an F1-score of 95.84%. Additionally, a web-based dashboard was developed to visualize detection outcomes, facilitating real-time monitoring. This research highlights the importance of efficient data preprocessing and feature selection for improving detection capabilities in IoT/Cloud infrastructures. Furthermore, the potential integration of metaheuristic optimization for hyperparameter tuning and feature selection is identified as a promising direction for future work. The findings contribute to the development of more resilient and adaptive cybersecurity solutions for IoT/Cloud-based environments. c 2025 15 6012 20  
their frequently poor maintenance, limited monitoring capabilities, and scarce security updates, conditions that make them ideal vectors for executing DDoS attacks. Consequently, protecting these environments becomes critical to ensuring operational resilience and service continuity in modern industrial ecosystems [1]. Effective detection and mitigation of these types of attack is critical to the security and performance of systems in general, which has fostered interest in researching and developing new detection and defense techniques. Some authors propose design and algorithmic analysis based on the historical behavioral data of compromised systems in various architectures, including cloud environments [2] and IoT devices [3]. According to the proposal, the detection of network anomalies and the identification of anomalous network traffic patterns can be solved through machine learning, especially those related to DDoS attacks, since these algorithms can learn to recognize unusual behaviors that could go unnoticed by traditional security methods (IDS), which increases the capacity for adaptation and continuous learning, as opposed to the constant evolution of cyber-attacks, which have been taking increasingly sophisticated and complex forms. Despite the existing advances in the development of machine- and deep-learning algorithms for the detection of DDoS attacks, there are still significant challenges related to the efficiency and effectiveness of the models, as well as their optimization to ensure their correct operation in IoT environments. This research seeks to explore alternatives to improve the detection and mitigation of these attacks using optimization and feature selection approaches that can improve their effectiveness and efficiency, with the aim of ensuring stability and security in this type of networks. The proposed solutions are supported by recent advances in the field of cybersecurity and artificial intelligence, offering an innovative approach to cybersecurity in these environments, considering the lowest possible use of resources to achieve it [4]. For the training of the models, the correct use of available datasets that focus on this type of attacks in IoT infrastructure is of utmost importance, including data such as network traffic characteristics such as package rates, response times, and protocol types, which would allow the identification of anomalous patterns.