Cloud computing has emerged as a popular computing paradigm, providing scalable and pay-per-use services to execute a variety of tasks. However, selecting the most suitable cloud services for a client can be challenging, as it involves taking into account the service characteristics and a set of client restrictions. In this paper, we formalize the problem of Service Selection under Uncertainty (SSuU) as an optimization problem. Our goal is to allocate tasks to appropriate cloud services while considering the probability of Service Level Agreement (SLA) violations and a set of client restrictions. We introduce an efficient dynamic programming approach to calculate the probability of SLA violations incrementally over time. We prove that the SSuU problem is strongly NP-complete, and propose an Integer Linear Programming (ILP) formulation and an Iterated Local Search-based algorithm for tackling it. To facilitate evaluation, we also introduce a set of benchmark instances for the SSuU problem. We extensively evaluate our proposed solutions on 94 input instances and compare them to the exact method (i.e., which always produces the optimal solution). Our results demonstrate that the metaheuristic approach is significantly faster and leads to exact solutions in the great majority of the evaluation scenarios.