One of the major security challenges in cloud computing is Distributed denial of service (DDoS) attacks. In these attacks, multiple nodes are used to attack the cloud by sending a large number of requests. This results in the unavailability of cloud services to legitimate users. In this research paper, a hybrid machine learning-based technique has been proposed which is a combination of extreme learning machine (ELM) model and blackhole optimization algorithm. The proposed technique is used to implement a DDoS attack detection system for cloud computing. Various experiments have been performed with the help of four benchmark datasets namely, NSL KDD, ISCX IDS 2012, CICIDS2017, and CICDDoS2019, to evaluate the performance of our proposed technique. It achieves an accuracy of 99.23%, 92.19%, 99.50%, 99.80% with NSL KDD, ISCX IDS 2012, CICIDS2017, and CICDDoS2019, respectively. The performance comparison with other techniques based on ELM, ANN trained with blackhole optimization, backpropagation ANN, and other state-of-the-art techniques is also performed.