The introduction of network function virtualization (NFV) leads to a new business model in which the Telecommunication Service Provider needs to rent cloud resources to infrastructure provider (InP) at prices as low as possible. Lowest prices can be achieved if the cloud resources can be rented in advance by allocating long-term virtual machines (VM). This is in contrast with the short-term VMs that are rented on demand and have higher costs. For this reason, we propose a proactive solution in which the cloud resource rent is planned in advance based on peak traffic knowledge. We illustrate the problem of determining the cloud resources in cloud infrastructures managed by different InPs and so as to minimize the sum of cloud resource, bandwidth and deployment costs. We formulate an integer linear problem (ILP) and due to its complexity, we introduce an efficient heuristic approach allowing for a remarkable computational complexity reduction. We compare our solution to a reactive solution in which the cloud resources are rented on demand and dimensioned according to the current traffic. Though the proposed proactive solution needs more cloud and bandwidth resources due to its peak allocation, its total resources cost may be lower than the one achieved when a reactive solution is applied. That is a consequence of the higher cost of short-term VMs. For instance, when a reactive solution is applied with traffic variation times of ten minutes, our proactive solution allows for lower total costs when the long-term VM rent is lower than the short-term VM one by 33%.INDEX TERMS Network function virtualization, cloud infrastructure, short-term virtual machine, Viterbi algorithm.