A modern web service or the Internet of Things (IoT) based service is composed of various loosely-coupled service components, called microservices, running on the cloud resource. It enables that the number of active servers be adjusted following the load fluctuation, so an efficient cloud resource allocation is required. This situation is modeled as variable-sized dynamic bin packing problem where each service component and cloud virtual machine is abstracted to item and bin, respectively. The bin capacity and cost is variable just the same as the cloud virtual machines have various computing power and usage cost. Items can dynamically join to and leave during the service lifetime, reflecting that service components and servers are deployed and undeployed following the load fluctuation. The objective function is to minimize the accumulated cost of active bins over time. We formulated this problem as MinUsageCost variable sized dynamic bin packing (MinUsageCost VSDBP) and suggested a hybrid selective-anyfit genetic algorithm. We simulated and evaluated its performance by measuring its cost overhead in the unit of percentage. The suggested algorithm shows the cost saving of 9.9 percent point compared to the most recent heuristic algorithm of MinUsageTime DBP problem.