Distributed denial of service (DDoS) attack is a subclass of denial of service attack that performs severe attack in a cloud computing environment. It makes a malicious attempt to disturb the usual services of any network or server by using botnets. Hence, an efficient intrusion detection system (IDS) is essential to detect this attack. Some limitations in the existing IDS models for DDoS attack detection are delayed convergence, local stagnation issues, and local and global optimal trapping issues. These limitations are met by the recurrent neural network (RNN) and deep learning- (DL-) based proposed models that can utilize the previous states of the hidden neuron. The proposed research has used a long short-term memory (LSTM) recurrent neural network and autoencoder- and decoder-based deep learning strategy with gradient descent learning rule. The network parameters like weight vectors and bias coefficient are tuned optimally by employing the proposed a hybrid Harris Hawks optimization (HHO) and particle swarm optimization (PSO) algorithm. The proposed hybrid optimization algorithm selects the essential attributes, and the results obtained confirmed that the proposed LSTM and deep learning model outperformed all other models developed in the literature.