In a virtual environment, load balancing is the best method of assigning a collection of tasks through a range of resources, in order to make the total output more efficient. Load balancers not only improve efficiency but also ensure system stability. Resource allocation in a virtual environment in this article is accomplished by using Amazon Web Services (AWS) and machine learning techniques. Round Robin resource allocation algorithm is used by HAProxy to perform Load Balancing responsibilities. The virtual servers created through Amazon Elastic Compute Cloud (EC2), all have the same characteristics, such as load bearing capacity and reaction time. One of the EC2 instances created is configured to host the HAProxy. The load bearing potential of HAProxy is inversely proportional to the execution time, ensuring faster processing of the incoming requests. HAProxy, as the load balancer, optimizes resource allocation and provides flexibility in contrast to a standard application load balancer. The logs created by the instances help predict future load on the servers, by applying the ARIMA time-series forecasting model. A Mean Squared Error of 3.28 is obtained, justifying the accuracy of the prediction.